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 loadUrl(String url)102 public void loadUrl(String url) { 103 } 104 loadData(String data, String mimeType, String encoding)105 public void loadData(String data, String mimeType, String encoding) { 106 } 107 loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String failUrl)108 public void loadDataWithBaseURL(String baseUrl, String data, 109 String mimeType, String encoding, String failUrl) { 110 } 111 stopLoading()112 public void stopLoading() { 113 } 114 reload()115 public void reload() { 116 } 117 canGoBack()118 public boolean canGoBack() { 119 return false; 120 } 121 goBack()122 public void goBack() { 123 } 124 canGoForward()125 public boolean canGoForward() { 126 return false; 127 } 128 goForward()129 public void goForward() { 130 } 131 canGoBackOrForward(int steps)132 public boolean canGoBackOrForward(int steps) { 133 return false; 134 } 135 goBackOrForward(int steps)136 public void goBackOrForward(int steps) { 137 } 138 pageUp(boolean top)139 public boolean pageUp(boolean top) { 140 return false; 141 } 142 pageDown(boolean bottom)143 public boolean pageDown(boolean bottom) { 144 return false; 145 } 146 clearView()147 public void clearView() { 148 } 149 capturePicture()150 public Picture capturePicture() { 151 return null; 152 } 153 getScale()154 public float getScale() { 155 return 0; 156 } 157 setInitialScale(int scaleInPercent)158 public void setInitialScale(int scaleInPercent) { 159 } 160 invokeZoomPicker()161 public void invokeZoomPicker() { 162 } 163 requestFocusNodeHref(Message hrefMsg)164 public void requestFocusNodeHref(Message hrefMsg) { 165 } 166 requestImageRef(Message msg)167 public void requestImageRef(Message msg) { 168 } 169 getUrl()170 public String getUrl() { 171 return null; 172 } 173 getTitle()174 public String getTitle() { 175 return null; 176 } 177 getFavicon()178 public Bitmap getFavicon() { 179 return null; 180 } 181 getProgress()182 public int getProgress() { 183 return 0; 184 } 185 getContentHeight()186 public int getContentHeight() { 187 return 0; 188 } 189 pauseTimers()190 public void pauseTimers() { 191 } 192 resumeTimers()193 public void resumeTimers() { 194 } 195 clearCache()196 public void clearCache() { 197 } 198 clearFormData()199 public void clearFormData() { 200 } 201 clearHistory()202 public void clearHistory() { 203 } 204 clearSslPreferences()205 public void clearSslPreferences() { 206 } 207 findAddress(String addr)208 public static String findAddress(String addr) { 209 return null; 210 } 211 documentHasImages(Message response)212 public void documentHasImages(Message response) { 213 } 214 setWebViewClient(WebViewClient client)215 public void setWebViewClient(WebViewClient client) { 216 } 217 setDownloadListener(DownloadListener listener)218 public void setDownloadListener(DownloadListener listener) { 219 } 220 setWebChromeClient(WebChromeClient client)221 public void setWebChromeClient(WebChromeClient client) { 222 } 223 addJavascriptInterface(Object obj, String interfaceName)224 public void addJavascriptInterface(Object obj, String interfaceName) { 225 } 226 getZoomControls()227 public View getZoomControls() { 228 return null; 229 } 230 zoomIn()231 public boolean zoomIn() { 232 return false; 233 } 234 zoomOut()235 public boolean zoomOut() { 236 return false; 237 } 238 } 239