1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.webkit; 18 19 import com.android.layoutlib.bridge.MockView; 20 21 import android.content.Context; 22 import android.graphics.Bitmap; 23 import android.graphics.Picture; 24 import android.os.Bundle; 25 import android.os.Message; 26 import android.util.AttributeSet; 27 import android.view.View; 28 29 /** 30 * Mock version of the WebView. 31 * Only non override public methods from the real WebView have been added in there. 32 * Methods that take an unknown class as parameter or as return object, have been removed for now. 33 * 34 * TODO: generate automatically. 35 * 36 */ 37 public class WebView extends MockView { 38 39 /** 40 * Construct a new WebView with a Context object. 41 * @param context A Context object used to access application assets. 42 */ WebView(Context context)43 public WebView(Context context) { 44 this(context, null); 45 } 46 47 /** 48 * Construct a new WebView with layout parameters. 49 * @param context A Context object used to access application assets. 50 * @param attrs An AttributeSet passed to our parent. 51 */ WebView(Context context, AttributeSet attrs)52 public WebView(Context context, AttributeSet attrs) { 53 this(context, attrs, com.android.internal.R.attr.webViewStyle); 54 } 55 56 /** 57 * Construct a new WebView with layout parameters and a default style. 58 * @param context A Context object used to access application assets. 59 * @param attrs An AttributeSet passed to our parent. 60 * @param defStyle The default style resource ID. 61 */ WebView(Context context, AttributeSet attrs, int defStyle)62 public WebView(Context context, AttributeSet attrs, int defStyle) { 63 super(context, attrs, defStyle); 64 } 65 66 // START FAKE PUBLIC METHODS 67 setHorizontalScrollbarOverlay(boolean overlay)68 public void setHorizontalScrollbarOverlay(boolean overlay) { 69 } 70 setVerticalScrollbarOverlay(boolean overlay)71 public void setVerticalScrollbarOverlay(boolean overlay) { 72 } 73 overlayHorizontalScrollbar()74 public boolean overlayHorizontalScrollbar() { 75 return false; 76 } 77 overlayVerticalScrollbar()78 public boolean overlayVerticalScrollbar() { 79 return false; 80 } 81 savePassword(String host, String username, String password)82 public void savePassword(String host, String username, String password) { 83 } 84 setHttpAuthUsernamePassword(String host, String realm, String username, String password)85 public void setHttpAuthUsernamePassword(String host, String realm, 86 String username, String password) { 87 } 88 getHttpAuthUsernamePassword(String host, String realm)89 public String[] getHttpAuthUsernamePassword(String host, String realm) { 90 return null; 91 } 92 destroy()93 public void destroy() { 94 } 95 enablePlatformNotifications()96 public static void enablePlatformNotifications() { 97 } 98 disablePlatformNotifications()99 public static void disablePlatformNotifications() { 100 } 101 saveState(Bundle outState)102 public WebBackForwardList saveState(Bundle outState) { 103 return null; 104 } 105 restoreState(Bundle inState)106 public WebBackForwardList restoreState(Bundle inState) { 107 return null; 108 } 109 loadUrl(String url)110 public void loadUrl(String url) { 111 } 112 loadData(String data, String mimeType, String encoding)113 public void loadData(String data, String mimeType, String encoding) { 114 } 115 loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String failUrl)116 public void loadDataWithBaseURL(String baseUrl, String data, 117 String mimeType, String encoding, String failUrl) { 118 } 119 stopLoading()120 public void stopLoading() { 121 } 122 reload()123 public void reload() { 124 } 125 canGoBack()126 public boolean canGoBack() { 127 return false; 128 } 129 goBack()130 public void goBack() { 131 } 132 canGoForward()133 public boolean canGoForward() { 134 return false; 135 } 136 goForward()137 public void goForward() { 138 } 139 canGoBackOrForward(int steps)140 public boolean canGoBackOrForward(int steps) { 141 return false; 142 } 143 goBackOrForward(int steps)144 public void goBackOrForward(int steps) { 145 } 146 pageUp(boolean top)147 public boolean pageUp(boolean top) { 148 return false; 149 } 150 pageDown(boolean bottom)151 public boolean pageDown(boolean bottom) { 152 return false; 153 } 154 clearView()155 public void clearView() { 156 } 157 capturePicture()158 public Picture capturePicture() { 159 return null; 160 } 161 getScale()162 public float getScale() { 163 return 0; 164 } 165 setInitialScale(int scaleInPercent)166 public void setInitialScale(int scaleInPercent) { 167 } 168 invokeZoomPicker()169 public void invokeZoomPicker() { 170 } 171 requestFocusNodeHref(Message hrefMsg)172 public void requestFocusNodeHref(Message hrefMsg) { 173 } 174 requestImageRef(Message msg)175 public void requestImageRef(Message msg) { 176 } 177 getUrl()178 public String getUrl() { 179 return null; 180 } 181 getTitle()182 public String getTitle() { 183 return null; 184 } 185 getFavicon()186 public Bitmap getFavicon() { 187 return null; 188 } 189 getProgress()190 public int getProgress() { 191 return 0; 192 } 193 getContentHeight()194 public int getContentHeight() { 195 return 0; 196 } 197 pauseTimers()198 public void pauseTimers() { 199 } 200 resumeTimers()201 public void resumeTimers() { 202 } 203 clearCache()204 public void clearCache() { 205 } 206 clearFormData()207 public void clearFormData() { 208 } 209 clearHistory()210 public void clearHistory() { 211 } 212 clearSslPreferences()213 public void clearSslPreferences() { 214 } 215 copyBackForwardList()216 public WebBackForwardList copyBackForwardList() { 217 return null; 218 } 219 findAddress(String addr)220 public static String findAddress(String addr) { 221 return null; 222 } 223 documentHasImages(Message response)224 public void documentHasImages(Message response) { 225 } 226 setWebViewClient(WebViewClient client)227 public void setWebViewClient(WebViewClient client) { 228 } 229 setDownloadListener(DownloadListener listener)230 public void setDownloadListener(DownloadListener listener) { 231 } 232 setWebChromeClient(WebChromeClient client)233 public void setWebChromeClient(WebChromeClient client) { 234 } 235 addJavascriptInterface(Object obj, String interfaceName)236 public void addJavascriptInterface(Object obj, String interfaceName) { 237 } 238 getSettings()239 public WebSettings getSettings() { 240 return null; 241 } 242 getZoomControls()243 public View getZoomControls() { 244 return null; 245 } 246 zoomIn()247 public boolean zoomIn() { 248 return false; 249 } 250 zoomOut()251 public boolean zoomOut() { 252 return false; 253 } 254 } 255