The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 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 com.android.dumprendertree; |
| 18 | |
Guang Zhu | 6bf18ba | 2009-09-15 23:47:20 -0700 | [diff] [blame] | 19 | import com.android.dumprendertree.forwarder.ForwardService; |
| 20 | |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 21 | import android.app.Activity; |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 22 | import android.app.AlertDialog; |
Andrei Popescu | 4950b2b | 2009-09-03 13:56:07 +0100 | [diff] [blame] | 23 | import android.content.Context; |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 24 | import android.content.DialogInterface; |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 25 | import android.content.Intent; |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 26 | import android.content.DialogInterface.OnClickListener; |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 27 | import android.graphics.Bitmap; |
Guang Zhu | 5dc4f21 | 2009-10-29 18:24:54 -0700 | [diff] [blame] | 28 | import android.graphics.Canvas; |
| 29 | import android.graphics.Bitmap.CompressFormat; |
| 30 | import android.graphics.Bitmap.Config; |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 31 | import android.net.http.SslError; |
| 32 | import android.os.Bundle; |
Christian Mehlmauer | 8b85dce | 2010-07-19 20:11:27 +0200 | [diff] [blame] | 33 | import android.os.Environment; |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 34 | import android.os.Handler; |
| 35 | import android.os.Message; |
| 36 | import android.util.Log; |
| 37 | import android.view.ViewGroup; |
Ben Murdoch | 9b815d0 | 2010-06-01 18:45:10 +0100 | [diff] [blame] | 38 | import android.view.Window; |
Kristian Monsen | 16d041c | 2010-12-06 13:43:51 +0000 | [diff] [blame] | 39 | import android.webkit.CookieManager; |
Guang Zhu | 6c15f60 | 2010-05-03 11:49:04 -0700 | [diff] [blame] | 40 | import android.webkit.ConsoleMessage; |
Ben Murdoch | 7e73ce9 | 2011-01-20 11:21:24 +0000 | [diff] [blame] | 41 | import android.webkit.CookieManager; |
Steve Block | dad347c | 2009-08-19 18:46:34 +0100 | [diff] [blame] | 42 | import android.webkit.GeolocationPermissions; |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 43 | import android.webkit.HttpAuthHandler; |
| 44 | import android.webkit.JsPromptResult; |
| 45 | import android.webkit.JsResult; |
| 46 | import android.webkit.SslErrorHandler; |
| 47 | import android.webkit.WebChromeClient; |
| 48 | import android.webkit.WebSettings; |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 49 | import android.webkit.WebStorage; |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 50 | import android.webkit.WebView; |
| 51 | import android.webkit.WebViewClient; |
| 52 | import android.widget.LinearLayout; |
| 53 | |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 54 | import java.io.BufferedReader; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 55 | import java.io.File; |
| 56 | import java.io.FileOutputStream; |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 57 | import java.io.FileReader; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 58 | import java.io.IOException; |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 59 | import java.net.MalformedURLException; |
| 60 | import java.net.URL; |
Andrei Popescu | 4950b2b | 2009-09-03 13:56:07 +0100 | [diff] [blame] | 61 | import java.util.HashMap; |
Steve Block | f0f30c6 | 2010-08-18 15:15:42 +0100 | [diff] [blame] | 62 | import java.util.Iterator; |
Andrei Popescu | 4950b2b | 2009-09-03 13:56:07 +0100 | [diff] [blame] | 63 | import java.util.Map; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 64 | import java.util.Vector; |
| 65 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 66 | public class TestShellActivity extends Activity implements LayoutTestController { |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 67 | |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 68 | static enum DumpDataType {DUMP_AS_TEXT, EXT_REPR, NO_OP} |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 69 | |
Steve Block | fb0de34 | 2010-03-19 18:48:35 +0000 | [diff] [blame] | 70 | // String constants for use with layoutTestController.overridePreferences |
Steve Block | 5f37cc43 | 2010-10-13 18:44:31 +0100 | [diff] [blame] | 71 | private final String WEBKIT_OFFLINE_WEB_APPLICATION_CACHE_ENABLED = |
| 72 | "WebKitOfflineWebApplicationCacheEnabled"; |
| 73 | private final String WEBKIT_USES_PAGE_CACHE_PREFERENCE_KEY = "WebKitUsesPageCachePreferenceKey"; |
Steve Block | fb0de34 | 2010-03-19 18:48:35 +0000 | [diff] [blame] | 74 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 75 | public class AsyncHandler extends Handler { |
| 76 | @Override |
| 77 | public void handleMessage(Message msg) { |
| 78 | if (msg.what == MSG_TIMEOUT) { |
| 79 | mTimedOut = true; |
Guang Zhu | 4ce6e7c | 2011-01-14 16:17:20 -0800 | [diff] [blame] | 80 | mWebView.stopLoading(); |
Guang Zhu | 56a3693 | 2009-09-28 09:53:48 -0700 | [diff] [blame] | 81 | if (mCallback != null) |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 82 | mCallback.timedOut(mWebView.getUrl()); |
Guang Zhu | 56a3693 | 2009-09-28 09:53:48 -0700 | [diff] [blame] | 83 | if (!mRequestedWebKitData) { |
Guang Zhu | 7216047 | 2009-09-25 17:34:12 -0700 | [diff] [blame] | 84 | requestWebKitData(); |
| 85 | } else { |
| 86 | // if timed out and webkit data has been dumped before |
| 87 | // finish directly |
| 88 | finished(); |
| 89 | } |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 90 | return; |
| 91 | } else if (msg.what == MSG_WEBKIT_DATA) { |
Guang Zhu | f2f7f56 | 2010-12-23 16:25:47 -0800 | [diff] [blame] | 92 | mHandler.removeMessages(MSG_DUMP_TIMEOUT); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 93 | TestShellActivity.this.dump(mTimedOut, (String)msg.obj); |
| 94 | return; |
Guang Zhu | f37a574 | 2010-12-23 14:37:31 -0800 | [diff] [blame] | 95 | } else if (msg.what == MSG_DUMP_TIMEOUT) { |
| 96 | throw new RuntimeException("WebView dump timeout, is it pegged?"); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 97 | } |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 98 | super.handleMessage(msg); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | public void requestWebKitData() { |
| 103 | Message callback = mHandler.obtainMessage(MSG_WEBKIT_DATA); |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 104 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 105 | if (mRequestedWebKitData) |
| 106 | throw new AssertionError("Requested webkit data twice: " + mWebView.getUrl()); |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 107 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 108 | mRequestedWebKitData = true; |
Guang Zhu | 7216047 | 2009-09-25 17:34:12 -0700 | [diff] [blame] | 109 | Log.v(LOGTAG, "message sent to WebView to dump text."); |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 110 | switch (mDumpDataType) { |
| 111 | case DUMP_AS_TEXT: |
Shimeng (Simon) Wang | ad45686 | 2010-06-16 17:32:24 -0700 | [diff] [blame] | 112 | callback.arg1 = mDumpTopFrameAsText ? 1 : 0; |
| 113 | callback.arg2 = mDumpChildFramesAsText ? 1 : 0; |
Guang Zhu | f37a574 | 2010-12-23 14:37:31 -0800 | [diff] [blame] | 114 | setDumpTimeout(DUMP_TIMEOUT_MS); |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 115 | mWebView.documentAsText(callback); |
| 116 | break; |
| 117 | case EXT_REPR: |
| 118 | mWebView.externalRepresentation(callback); |
Guang Zhu | f37a574 | 2010-12-23 14:37:31 -0800 | [diff] [blame] | 119 | setDumpTimeout(DUMP_TIMEOUT_MS); |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 120 | break; |
| 121 | default: |
| 122 | finished(); |
| 123 | break; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 124 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 125 | } |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 126 | |
Guang Zhu | f37a574 | 2010-12-23 14:37:31 -0800 | [diff] [blame] | 127 | private void setDumpTimeout(long timeout) { |
Guang Zhu | 49171bc | 2011-05-10 19:08:08 -0700 | [diff] [blame] | 128 | Log.v(LOGTAG, "setting dump timeout at " + timeout); |
Guang Zhu | f37a574 | 2010-12-23 14:37:31 -0800 | [diff] [blame] | 129 | Message msg = mHandler.obtainMessage(MSG_DUMP_TIMEOUT); |
| 130 | mHandler.sendMessageDelayed(msg, timeout); |
| 131 | } |
| 132 | |
Guang Zhu | 889181d | 2009-07-09 12:55:15 -0700 | [diff] [blame] | 133 | public void clearCache() { |
Guang Zhu | f56e1a1 | 2009-07-20 11:16:28 -0700 | [diff] [blame] | 134 | mWebView.freeMemory(); |
Guang Zhu | 889181d | 2009-07-09 12:55:15 -0700 | [diff] [blame] | 135 | } |
| 136 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 137 | @Override |
| 138 | protected void onCreate(Bundle icicle) { |
| 139 | super.onCreate(icicle); |
Ben Murdoch | 9b815d0 | 2010-06-01 18:45:10 +0100 | [diff] [blame] | 140 | requestWindowFeature(Window.FEATURE_PROGRESS); |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 141 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 142 | LinearLayout contentView = new LinearLayout(this); |
| 143 | contentView.setOrientation(LinearLayout.VERTICAL); |
| 144 | setContentView(contentView); |
| 145 | |
Kristian Monsen | 16d041c | 2010-12-06 13:43:51 +0000 | [diff] [blame] | 146 | CookieManager.setAcceptFileSchemeCookies(true); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 147 | mWebView = new WebView(this); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 148 | mEventSender = new WebViewEventSender(mWebView); |
| 149 | mCallbackProxy = new CallbackProxy(mEventSender, this); |
| 150 | |
Andrei Popescu | 4950b2b | 2009-09-03 13:56:07 +0100 | [diff] [blame] | 151 | mWebView.addJavascriptInterface(mCallbackProxy, "layoutTestController"); |
| 152 | mWebView.addJavascriptInterface(mCallbackProxy, "eventSender"); |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 153 | setupWebViewForLayoutTests(mWebView, mCallbackProxy); |
| 154 | |
Romain Guy | 980a938 | 2010-01-08 15:06:28 -0800 | [diff] [blame] | 155 | contentView.addView(mWebView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 0.0f)); |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 156 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 157 | mWebView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL); |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 158 | |
Feng Qian | 2890920 | 2009-08-13 14:54:56 -0700 | [diff] [blame] | 159 | // Expose window.gc function to JavaScript. JSC build exposes |
| 160 | // this function by default, but V8 requires the flag to turn it on. |
| 161 | // WebView::setJsFlags is noop in JSC build. |
| 162 | mWebView.setJsFlags("--expose_gc"); |
| 163 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 164 | mHandler = new AsyncHandler(); |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 165 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 166 | Intent intent = getIntent(); |
| 167 | if (intent != null) { |
| 168 | executeIntent(intent); |
| 169 | } |
Steve Block | 68dede3 | 2010-08-04 10:28:46 +0100 | [diff] [blame] | 170 | |
| 171 | // This is asynchronous, but it gets processed by WebCore before it starts loading pages. |
| 172 | mWebView.useMockDeviceOrientation(); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 173 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 174 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 175 | @Override |
| 176 | protected void onNewIntent(Intent intent) { |
| 177 | super.onNewIntent(intent); |
| 178 | executeIntent(intent); |
| 179 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 180 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 181 | private void executeIntent(Intent intent) { |
| 182 | resetTestStatus(); |
| 183 | if (!Intent.ACTION_VIEW.equals(intent.getAction())) { |
| 184 | return; |
| 185 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 186 | |
Ben Murdoch | 9b815d0 | 2010-06-01 18:45:10 +0100 | [diff] [blame] | 187 | mTotalTestCount = intent.getIntExtra(TOTAL_TEST_COUNT, mTotalTestCount); |
| 188 | mCurrentTestNumber = intent.getIntExtra(CURRENT_TEST_NUMBER, mCurrentTestNumber); |
| 189 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 190 | mTestUrl = intent.getStringExtra(TEST_URL); |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 191 | if (mTestUrl == null) { |
| 192 | mUiAutoTestPath = intent.getStringExtra(UI_AUTO_TEST); |
| 193 | if(mUiAutoTestPath != null) { |
| 194 | beginUiAutoTest(); |
| 195 | } |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 196 | return; |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 197 | } |
| 198 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 199 | mResultFile = intent.getStringExtra(RESULT_FILE); |
| 200 | mTimeoutInMillis = intent.getIntExtra(TIMEOUT_IN_MILLIS, 0); |
Guang Zhu | 5dc4f21 | 2009-10-29 18:24:54 -0700 | [diff] [blame] | 201 | mGetDrawtime = intent.getBooleanExtra(GET_DRAW_TIME, false); |
| 202 | mSaveImagePath = intent.getStringExtra(SAVE_IMAGE); |
Guang Zhu | 5d53c19 | 2010-07-14 17:17:54 -0700 | [diff] [blame] | 203 | mStopOnRefError = intent.getBooleanExtra(STOP_ON_REF_ERROR, false); |
Ben Murdoch | 9b815d0 | 2010-06-01 18:45:10 +0100 | [diff] [blame] | 204 | setTitle("Test " + mCurrentTestNumber + " of " + mTotalTestCount); |
| 205 | float ratio = (float)mCurrentTestNumber / mTotalTestCount; |
| 206 | int progress = (int)(ratio * Window.PROGRESS_END); |
| 207 | getWindow().setFeatureInt(Window.FEATURE_PROGRESS, progress); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 208 | |
| 209 | Log.v(LOGTAG, " Loading " + mTestUrl); |
| 210 | mWebView.loadUrl(mTestUrl); |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 211 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 212 | if (mTimeoutInMillis > 0) { |
| 213 | // Create a timeout timer |
| 214 | Message m = mHandler.obtainMessage(MSG_TIMEOUT); |
| 215 | mHandler.sendMessageDelayed(m, mTimeoutInMillis); |
| 216 | } |
| 217 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 218 | |
| 219 | private void beginUiAutoTest() { |
| 220 | try { |
| 221 | mTestListReader = new BufferedReader( |
| 222 | new FileReader(mUiAutoTestPath)); |
| 223 | } catch (IOException ioe) { |
| 224 | Log.e(LOGTAG, "Failed to open test list for read.", ioe); |
| 225 | finishUiAutoTest(); |
| 226 | return; |
| 227 | } |
| 228 | moveToNextTest(); |
| 229 | } |
| 230 | |
| 231 | private void finishUiAutoTest() { |
| 232 | try { |
| 233 | if(mTestListReader != null) |
| 234 | mTestListReader.close(); |
| 235 | } catch (IOException ioe) { |
| 236 | Log.w(LOGTAG, "Failed to close test list file.", ioe); |
| 237 | } |
Guang Zhu | 6bf18ba | 2009-09-15 23:47:20 -0700 | [diff] [blame] | 238 | ForwardService.getForwardService().stopForwardService(); |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 239 | finished(); |
| 240 | } |
| 241 | |
| 242 | private void moveToNextTest() { |
| 243 | String url = null; |
| 244 | try { |
| 245 | url = mTestListReader.readLine(); |
| 246 | } catch (IOException ioe) { |
| 247 | Log.e(LOGTAG, "Failed to read next test.", ioe); |
| 248 | finishUiAutoTest(); |
| 249 | return; |
| 250 | } |
| 251 | if (url == null) { |
| 252 | mUiAutoTestPath = null; |
| 253 | finishUiAutoTest(); |
| 254 | AlertDialog.Builder builder = new AlertDialog.Builder(this); |
| 255 | builder.setMessage("All tests finished. Exit?") |
| 256 | .setCancelable(false) |
| 257 | .setPositiveButton("Yes", new OnClickListener(){ |
| 258 | public void onClick(DialogInterface dialog, int which) { |
| 259 | TestShellActivity.this.finish(); |
| 260 | } |
| 261 | }) |
| 262 | .setNegativeButton("No", new OnClickListener(){ |
| 263 | public void onClick(DialogInterface dialog, int which) { |
| 264 | dialog.cancel(); |
| 265 | } |
| 266 | }); |
| 267 | builder.create().show(); |
| 268 | return; |
| 269 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 270 | Intent intent = new Intent(Intent.ACTION_VIEW); |
| 271 | intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); |
Guang Zhu | 6bf18ba | 2009-09-15 23:47:20 -0700 | [diff] [blame] | 272 | intent.putExtra(TestShellActivity.TEST_URL, FsUtils.getTestUrl(url)); |
Ben Murdoch | 9b815d0 | 2010-06-01 18:45:10 +0100 | [diff] [blame] | 273 | intent.putExtra(TestShellActivity.CURRENT_TEST_NUMBER, ++mCurrentTestNumber); |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 274 | intent.putExtra(TIMEOUT_IN_MILLIS, 10000); |
| 275 | executeIntent(intent); |
| 276 | } |
| 277 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 278 | @Override |
| 279 | protected void onStop() { |
| 280 | super.onStop(); |
| 281 | mWebView.stopLoading(); |
| 282 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 283 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 284 | @Override |
| 285 | protected void onDestroy() { |
| 286 | super.onDestroy(); |
| 287 | mWebView.destroy(); |
| 288 | mWebView = null; |
| 289 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 290 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 291 | @Override |
| 292 | public void onLowMemory() { |
| 293 | super.onLowMemory(); |
Feng Qian | 0aeed6a | 2009-07-16 20:53:31 -0700 | [diff] [blame] | 294 | Log.e(LOGTAG, "Low memory, clearing caches"); |
| 295 | mWebView.freeMemory(); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | // Dump the page |
| 299 | public void dump(boolean timeout, String webkitData) { |
Ben Murdoch | 2eea5f3 | 2009-09-23 15:28:57 +0100 | [diff] [blame] | 300 | mDumpWebKitData = true; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 301 | if (mResultFile == null || mResultFile.length() == 0) { |
| 302 | finished(); |
| 303 | return; |
| 304 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 305 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 306 | try { |
| 307 | File parentDir = new File(mResultFile).getParentFile(); |
| 308 | if (!parentDir.exists()) { |
| 309 | parentDir.mkdirs(); |
| 310 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 311 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 312 | FileOutputStream os = new FileOutputStream(mResultFile); |
| 313 | if (timeout) { |
| 314 | Log.w("Layout test: Timeout", mResultFile); |
| 315 | os.write(TIMEOUT_STR.getBytes()); |
| 316 | os.write('\n'); |
| 317 | } |
| 318 | if (mDumpTitleChanges) |
| 319 | os.write(mTitleChanges.toString().getBytes()); |
| 320 | if (mDialogStrings != null) |
| 321 | os.write(mDialogStrings.toString().getBytes()); |
| 322 | mDialogStrings = null; |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 323 | if (mDatabaseCallbackStrings != null) |
| 324 | os.write(mDatabaseCallbackStrings.toString().getBytes()); |
| 325 | mDatabaseCallbackStrings = null; |
| 326 | if (mConsoleMessages != null) |
| 327 | os.write(mConsoleMessages.toString().getBytes()); |
| 328 | mConsoleMessages = null; |
Feng Qian | be42388b | 2009-04-16 10:05:38 -0700 | [diff] [blame] | 329 | if (webkitData != null) |
| 330 | os.write(webkitData.getBytes()); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 331 | os.flush(); |
| 332 | os.close(); |
| 333 | } catch (IOException ex) { |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 334 | Log.e(LOGTAG, "Cannot write to " + mResultFile + ", " + ex.getMessage()); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 335 | } |
| 336 | |
| 337 | finished(); |
| 338 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 339 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 340 | public void setCallback(TestShellCallback callback) { |
| 341 | mCallback = callback; |
| 342 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 343 | |
Ben Murdoch | 2eea5f3 | 2009-09-23 15:28:57 +0100 | [diff] [blame] | 344 | public boolean finished() { |
| 345 | if (canMoveToNextTest()) { |
| 346 | mHandler.removeMessages(MSG_TIMEOUT); |
Ben Murdoch | 977f769 | 2009-09-16 20:13:07 +0100 | [diff] [blame] | 347 | if (mUiAutoTestPath != null) { |
| 348 | //don't really finish here |
| 349 | moveToNextTest(); |
| 350 | } else { |
| 351 | if (mCallback != null) { |
| 352 | mCallback.finished(); |
| 353 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 354 | } |
Ben Murdoch | 2eea5f3 | 2009-09-23 15:28:57 +0100 | [diff] [blame] | 355 | return true; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 356 | } |
Ben Murdoch | 2eea5f3 | 2009-09-23 15:28:57 +0100 | [diff] [blame] | 357 | return false; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 358 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 359 | |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 360 | public void setDefaultDumpDataType(DumpDataType defaultDumpDataType) { |
| 361 | mDefaultDumpDataType = defaultDumpDataType; |
| 362 | } |
| 363 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 364 | // ....................................... |
| 365 | // LayoutTestController Functions |
Ben Murdoch | 357d280 | 2010-07-23 16:18:58 +0100 | [diff] [blame] | 366 | public void dumpAsText(boolean enablePixelTests) { |
| 367 | // Added after webkit update to r63859. See trac.webkit.org/changeset/63730. |
| 368 | if (enablePixelTests) { |
| 369 | Log.v(LOGTAG, "dumpAsText(enablePixelTests == true) not implemented on Android!"); |
| 370 | } |
| 371 | |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 372 | mDumpDataType = DumpDataType.DUMP_AS_TEXT; |
Shimeng (Simon) Wang | ad45686 | 2010-06-16 17:32:24 -0700 | [diff] [blame] | 373 | mDumpTopFrameAsText = true; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 374 | if (mWebView != null) { |
| 375 | String url = mWebView.getUrl(); |
| 376 | Log.v(LOGTAG, "dumpAsText called: "+url); |
| 377 | } |
| 378 | } |
| 379 | |
Shimeng (Simon) Wang | ad45686 | 2010-06-16 17:32:24 -0700 | [diff] [blame] | 380 | public void dumpChildFramesAsText() { |
| 381 | mDumpDataType = DumpDataType.DUMP_AS_TEXT; |
| 382 | mDumpChildFramesAsText = true; |
| 383 | if (mWebView != null) { |
| 384 | String url = mWebView.getUrl(); |
| 385 | Log.v(LOGTAG, "dumpChildFramesAsText called: "+url); |
| 386 | } |
| 387 | } |
| 388 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 389 | public void waitUntilDone() { |
| 390 | mWaitUntilDone = true; |
| 391 | String url = mWebView.getUrl(); |
| 392 | Log.v(LOGTAG, "waitUntilDone called: " + url); |
| 393 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 394 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 395 | public void notifyDone() { |
| 396 | String url = mWebView.getUrl(); |
| 397 | Log.v(LOGTAG, "notifyDone called: " + url); |
| 398 | if (mWaitUntilDone) { |
| 399 | mWaitUntilDone = false; |
Ben Murdoch | 1620bcd | 2010-06-03 11:51:54 +0100 | [diff] [blame] | 400 | if (!mRequestedWebKitData && !mTimedOut && !finished()) { |
| 401 | requestWebKitData(); |
| 402 | } |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 403 | } |
| 404 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 405 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 406 | public void display() { |
| 407 | mWebView.invalidate(); |
| 408 | } |
| 409 | |
| 410 | public void clearBackForwardList() { |
| 411 | mWebView.clearHistory(); |
| 412 | |
| 413 | } |
| 414 | |
| 415 | public void dumpBackForwardList() { |
| 416 | //printf("\n============== Back Forward List ==============\n"); |
| 417 | // mWebHistory |
| 418 | //printf("===============================================\n"); |
| 419 | |
| 420 | } |
| 421 | |
| 422 | public void dumpChildFrameScrollPositions() { |
| 423 | // TODO Auto-generated method stub |
| 424 | |
| 425 | } |
| 426 | |
| 427 | public void dumpEditingCallbacks() { |
| 428 | // TODO Auto-generated method stub |
| 429 | |
| 430 | } |
| 431 | |
| 432 | public void dumpSelectionRect() { |
| 433 | // TODO Auto-generated method stub |
| 434 | |
| 435 | } |
| 436 | |
| 437 | public void dumpTitleChanges() { |
| 438 | if (!mDumpTitleChanges) { |
| 439 | mTitleChanges = new StringBuffer(); |
| 440 | } |
| 441 | mDumpTitleChanges = true; |
| 442 | } |
| 443 | |
| 444 | public void keepWebHistory() { |
| 445 | if (!mKeepWebHistory) { |
| 446 | mWebHistory = new Vector(); |
| 447 | } |
| 448 | mKeepWebHistory = true; |
| 449 | } |
| 450 | |
| 451 | public void queueBackNavigation(int howfar) { |
| 452 | // TODO Auto-generated method stub |
| 453 | |
| 454 | } |
| 455 | |
| 456 | public void queueForwardNavigation(int howfar) { |
| 457 | // TODO Auto-generated method stub |
| 458 | |
| 459 | } |
| 460 | |
| 461 | public void queueLoad(String Url, String frameTarget) { |
| 462 | // TODO Auto-generated method stub |
| 463 | |
| 464 | } |
| 465 | |
| 466 | public void queueReload() { |
| 467 | mWebView.reload(); |
| 468 | } |
| 469 | |
| 470 | public void queueScript(String scriptToRunInCurrentContext) { |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 471 | mWebView.loadUrl("javascript:"+scriptToRunInCurrentContext); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 472 | } |
| 473 | |
| 474 | public void repaintSweepHorizontally() { |
| 475 | // TODO Auto-generated method stub |
| 476 | |
| 477 | } |
| 478 | |
| 479 | public void setAcceptsEditing(boolean b) { |
| 480 | // TODO Auto-generated method stub |
| 481 | |
| 482 | } |
| 483 | |
| 484 | public void setMainFrameIsFirstResponder(boolean b) { |
| 485 | // TODO Auto-generated method stub |
| 486 | |
| 487 | } |
| 488 | |
| 489 | public void setWindowIsKey(boolean b) { |
| 490 | // This is meant to show/hide the window. The best I can find |
| 491 | // is setEnabled() |
| 492 | mWebView.setEnabled(b); |
| 493 | } |
| 494 | |
| 495 | public void testRepaint() { |
| 496 | mWebView.invalidate(); |
| 497 | } |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 498 | |
| 499 | public void dumpDatabaseCallbacks() { |
| 500 | Log.v(LOGTAG, "dumpDatabaseCallbacks called."); |
| 501 | mDumpDatabaseCallbacks = true; |
| 502 | } |
| 503 | |
| 504 | public void setCanOpenWindows() { |
| 505 | Log.v(LOGTAG, "setCanOpenWindows called."); |
| 506 | mCanOpenWindows = true; |
| 507 | } |
| 508 | |
Steve Block | dad347c | 2009-08-19 18:46:34 +0100 | [diff] [blame] | 509 | /** |
| 510 | * Sets the Geolocation permission state to be used for all future requests. |
| 511 | */ |
| 512 | public void setGeolocationPermission(boolean allow) { |
Steve Block | f0f30c6 | 2010-08-18 15:15:42 +0100 | [diff] [blame] | 513 | mIsGeolocationPermissionSet = true; |
Steve Block | dad347c | 2009-08-19 18:46:34 +0100 | [diff] [blame] | 514 | mGeolocationPermission = allow; |
Steve Block | f0f30c6 | 2010-08-18 15:15:42 +0100 | [diff] [blame] | 515 | |
| 516 | if (mPendingGeolocationPermissionCallbacks != null) { |
| 517 | Iterator iter = mPendingGeolocationPermissionCallbacks.keySet().iterator(); |
| 518 | while (iter.hasNext()) { |
| 519 | GeolocationPermissions.Callback callback = |
| 520 | (GeolocationPermissions.Callback) iter.next(); |
| 521 | String origin = (String) mPendingGeolocationPermissionCallbacks.get(callback); |
| 522 | callback.invoke(origin, mGeolocationPermission, false); |
| 523 | } |
| 524 | mPendingGeolocationPermissionCallbacks = null; |
| 525 | } |
Steve Block | dad347c | 2009-08-19 18:46:34 +0100 | [diff] [blame] | 526 | } |
| 527 | |
Steve Block | 68dede3 | 2010-08-04 10:28:46 +0100 | [diff] [blame] | 528 | public void setMockDeviceOrientation(boolean canProvideAlpha, double alpha, |
| 529 | boolean canProvideBeta, double beta, boolean canProvideGamma, double gamma) { |
| 530 | mWebView.setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta, |
| 531 | canProvideGamma, gamma); |
| 532 | } |
| 533 | |
Steve Block | fb0de34 | 2010-03-19 18:48:35 +0000 | [diff] [blame] | 534 | public void overridePreference(String key, boolean value) { |
| 535 | // TODO: We should look up the correct WebView for the frame which |
| 536 | // called the layoutTestController method. Currently, we just use the |
| 537 | // WebView for the main frame. EventSender suffers from the same |
| 538 | // problem. |
Steve Block | 5f37cc43 | 2010-10-13 18:44:31 +0100 | [diff] [blame] | 539 | if (WEBKIT_OFFLINE_WEB_APPLICATION_CACHE_ENABLED.equals(key)) { |
Steve Block | fb0de34 | 2010-03-19 18:48:35 +0000 | [diff] [blame] | 540 | mWebView.getSettings().setAppCacheEnabled(value); |
Steve Block | 5f37cc43 | 2010-10-13 18:44:31 +0100 | [diff] [blame] | 541 | } else if (WEBKIT_USES_PAGE_CACHE_PREFERENCE_KEY.equals(key)) { |
| 542 | // Cache the maximum possible number of pages. |
| 543 | mWebView.getSettings().setPageCacheCapacity(Integer.MAX_VALUE); |
| 544 | } else { |
| 545 | Log.w(LOGTAG, "LayoutTestController.overridePreference(): " + |
| 546 | "Unsupported preference '" + key + "'"); |
Steve Block | fb0de34 | 2010-03-19 18:48:35 +0000 | [diff] [blame] | 547 | } |
| 548 | } |
| 549 | |
Elliott Slaughter | 5dc0c82 | 2010-06-22 11:31:54 -0700 | [diff] [blame] | 550 | public void setXSSAuditorEnabled (boolean flag) { |
| 551 | mWebView.getSettings().setXSSAuditorEnabled(flag); |
| 552 | } |
| 553 | |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 554 | private final WebViewClient mViewClient = new WebViewClient(){ |
| 555 | @Override |
| 556 | public void onPageFinished(WebView view, String url) { |
| 557 | Log.v(LOGTAG, "onPageFinished, url=" + url); |
Ben Murdoch | 2eea5f3 | 2009-09-23 15:28:57 +0100 | [diff] [blame] | 558 | mPageFinished = true; |
Guang Zhu | 5dc4f21 | 2009-10-29 18:24:54 -0700 | [diff] [blame] | 559 | // get page draw time |
| 560 | if (FsUtils.isTestPageUrl(url)) { |
| 561 | if (mGetDrawtime) { |
| 562 | long[] times = new long[DRAW_RUNS]; |
| 563 | times = getDrawWebViewTime(mWebView, DRAW_RUNS); |
| 564 | FsUtils.writeDrawTime(DRAW_TIME_LOG, url, times); |
| 565 | } |
| 566 | if (mSaveImagePath != null) { |
| 567 | String name = FsUtils.getLastSegmentInPath(url); |
| 568 | drawPageToFile(mSaveImagePath + "/" + name + ".png", mWebView); |
| 569 | } |
| 570 | } |
Ben Murdoch | 1620bcd | 2010-06-03 11:51:54 +0100 | [diff] [blame] | 571 | |
Ben Murdoch | 2eea5f3 | 2009-09-23 15:28:57 +0100 | [diff] [blame] | 572 | // Calling finished() will check if we've met all the conditions for completing |
Ben Murdoch | 1620bcd | 2010-06-03 11:51:54 +0100 | [diff] [blame] | 573 | // this test and move to the next one if we are ready. Otherwise we ask WebCore to |
| 574 | // dump the page. |
Ben Murdoch | 2eea5f3 | 2009-09-23 15:28:57 +0100 | [diff] [blame] | 575 | if (finished()) { |
| 576 | return; |
| 577 | } |
Ben Murdoch | 1620bcd | 2010-06-03 11:51:54 +0100 | [diff] [blame] | 578 | |
| 579 | if (!mWaitUntilDone && !mRequestedWebKitData && !mTimedOut) { |
| 580 | requestWebKitData(); |
| 581 | } else { |
| 582 | if (mWaitUntilDone) { |
| 583 | Log.v(LOGTAG, "page finished loading but waiting for notifyDone to be called: " + url); |
| 584 | } |
| 585 | |
| 586 | if (mRequestedWebKitData) { |
| 587 | Log.v(LOGTAG, "page finished loading but webkit data has already been requested: " + url); |
| 588 | } |
| 589 | |
| 590 | if (mTimedOut) { |
| 591 | Log.v(LOGTAG, "page finished loading but already timed out: " + url); |
| 592 | } |
| 593 | } |
| 594 | |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 595 | super.onPageFinished(view, url); |
| 596 | } |
| 597 | |
| 598 | @Override |
| 599 | public void onPageStarted(WebView view, String url, Bitmap favicon) { |
| 600 | Log.v(LOGTAG, "onPageStarted, url=" + url); |
Ben Murdoch | 2eea5f3 | 2009-09-23 15:28:57 +0100 | [diff] [blame] | 601 | mPageFinished = false; |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 602 | super.onPageStarted(view, url, favicon); |
| 603 | } |
| 604 | |
| 605 | @Override |
| 606 | public void onReceivedError(WebView view, int errorCode, String description, |
| 607 | String failingUrl) { |
| 608 | Log.v(LOGTAG, "onReceivedError, errorCode=" + errorCode |
| 609 | + ", desc=" + description + ", url=" + failingUrl); |
| 610 | super.onReceivedError(view, errorCode, description, failingUrl); |
| 611 | } |
| 612 | |
| 613 | @Override |
| 614 | public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, |
| 615 | String host, String realm) { |
Steve Block | 2bb2553 | 2010-03-25 14:48:13 +0000 | [diff] [blame] | 616 | if (handler.useHttpAuthUsernamePassword() && view != null) { |
| 617 | String[] credentials = view.getHttpAuthUsernamePassword(host, realm); |
| 618 | if (credentials != null && credentials.length == 2) { |
| 619 | handler.proceed(credentials[0], credentials[1]); |
| 620 | return; |
| 621 | } |
| 622 | } |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 623 | handler.cancel(); |
| 624 | } |
| 625 | |
| 626 | @Override |
| 627 | public void onReceivedSslError(WebView view, SslErrorHandler handler, |
| 628 | SslError error) { |
| 629 | handler.proceed(); |
| 630 | } |
| 631 | }; |
| 632 | |
| 633 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 634 | private final WebChromeClient mChromeClient = new WebChromeClient() { |
| 635 | @Override |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 636 | public void onReceivedTitle(WebView view, String title) { |
Ben Murdoch | 9b815d0 | 2010-06-01 18:45:10 +0100 | [diff] [blame] | 637 | setTitle("Test " + mCurrentTestNumber + " of " + mTotalTestCount + ": "+ title); |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 638 | if (mDumpTitleChanges) { |
| 639 | mTitleChanges.append("TITLE CHANGED: "); |
| 640 | mTitleChanges.append(title); |
| 641 | mTitleChanges.append("\n"); |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | @Override |
| 646 | public boolean onJsAlert(WebView view, String url, String message, |
| 647 | JsResult result) { |
| 648 | if (mDialogStrings == null) { |
| 649 | mDialogStrings = new StringBuffer(); |
| 650 | } |
| 651 | mDialogStrings.append("ALERT: "); |
| 652 | mDialogStrings.append(message); |
| 653 | mDialogStrings.append('\n'); |
| 654 | result.confirm(); |
| 655 | return true; |
| 656 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 657 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 658 | @Override |
| 659 | public boolean onJsConfirm(WebView view, String url, String message, |
| 660 | JsResult result) { |
| 661 | if (mDialogStrings == null) { |
| 662 | mDialogStrings = new StringBuffer(); |
| 663 | } |
| 664 | mDialogStrings.append("CONFIRM: "); |
| 665 | mDialogStrings.append(message); |
| 666 | mDialogStrings.append('\n'); |
| 667 | result.confirm(); |
| 668 | return true; |
| 669 | } |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 670 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 671 | @Override |
| 672 | public boolean onJsPrompt(WebView view, String url, String message, |
| 673 | String defaultValue, JsPromptResult result) { |
| 674 | if (mDialogStrings == null) { |
| 675 | mDialogStrings = new StringBuffer(); |
| 676 | } |
| 677 | mDialogStrings.append("PROMPT: "); |
| 678 | mDialogStrings.append(message); |
| 679 | mDialogStrings.append(", default text: "); |
| 680 | mDialogStrings.append(defaultValue); |
| 681 | mDialogStrings.append('\n'); |
| 682 | result.confirm(); |
| 683 | return true; |
| 684 | } |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 685 | |
| 686 | @Override |
Guang Zhu | f4bf552 | 2009-07-23 14:19:35 -0700 | [diff] [blame] | 687 | public boolean onJsTimeout() { |
| 688 | Log.v(LOGTAG, "JavaScript timeout"); |
| 689 | return false; |
| 690 | } |
| 691 | |
| 692 | @Override |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 693 | public void onExceededDatabaseQuota(String url_str, |
Ben Murdoch | d497d87 | 2009-08-25 19:32:54 +0100 | [diff] [blame] | 694 | String databaseIdentifier, long currentQuota, |
| 695 | long estimatedSize, long totalUsedQuota, |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 696 | WebStorage.QuotaUpdater callback) { |
| 697 | if (mDumpDatabaseCallbacks) { |
| 698 | if (mDatabaseCallbackStrings == null) { |
| 699 | mDatabaseCallbackStrings = new StringBuffer(); |
| 700 | } |
| 701 | |
| 702 | String protocol = ""; |
| 703 | String host = ""; |
| 704 | int port = 0; |
| 705 | |
| 706 | try { |
| 707 | URL url = new URL(url_str); |
| 708 | protocol = url.getProtocol(); |
| 709 | host = url.getHost(); |
| 710 | if (url.getPort() > -1) { |
| 711 | port = url.getPort(); |
| 712 | } |
| 713 | } catch (MalformedURLException e) {} |
| 714 | |
| 715 | String databaseCallbackString = |
| 716 | "UI DELEGATE DATABASE CALLBACK: " + |
| 717 | "exceededDatabaseQuotaForSecurityOrigin:{" + protocol + |
| 718 | ", " + host + ", " + port + "} database:" + |
| 719 | databaseIdentifier + "\n"; |
| 720 | Log.v(LOGTAG, "LOG: "+databaseCallbackString); |
| 721 | mDatabaseCallbackStrings.append(databaseCallbackString); |
| 722 | } |
| 723 | // Give 5MB more quota. |
| 724 | callback.updateQuota(currentQuota + 1024 * 1024 * 5); |
| 725 | } |
| 726 | |
Steve Block | dad347c | 2009-08-19 18:46:34 +0100 | [diff] [blame] | 727 | /** |
| 728 | * Instructs the client to show a prompt to ask the user to set the |
| 729 | * Geolocation permission state for the specified origin. |
| 730 | */ |
| 731 | @Override |
| 732 | public void onGeolocationPermissionsShowPrompt(String origin, |
| 733 | GeolocationPermissions.Callback callback) { |
Steve Block | f0f30c6 | 2010-08-18 15:15:42 +0100 | [diff] [blame] | 734 | if (mIsGeolocationPermissionSet) { |
Steve Block | dad347c | 2009-08-19 18:46:34 +0100 | [diff] [blame] | 735 | callback.invoke(origin, mGeolocationPermission, false); |
Steve Block | f0f30c6 | 2010-08-18 15:15:42 +0100 | [diff] [blame] | 736 | return; |
Steve Block | dad347c | 2009-08-19 18:46:34 +0100 | [diff] [blame] | 737 | } |
Steve Block | f0f30c6 | 2010-08-18 15:15:42 +0100 | [diff] [blame] | 738 | if (mPendingGeolocationPermissionCallbacks == null) { |
| 739 | mPendingGeolocationPermissionCallbacks = |
| 740 | new HashMap<GeolocationPermissions.Callback, String>(); |
| 741 | } |
| 742 | mPendingGeolocationPermissionCallbacks.put(callback, origin); |
Steve Block | dad347c | 2009-08-19 18:46:34 +0100 | [diff] [blame] | 743 | } |
| 744 | |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 745 | @Override |
Guang Zhu | 6c15f60 | 2010-05-03 11:49:04 -0700 | [diff] [blame] | 746 | public boolean onConsoleMessage(ConsoleMessage consoleMessage) { |
| 747 | String msg = "CONSOLE MESSAGE: line " + consoleMessage.lineNumber() + ": " |
| 748 | + consoleMessage.message() + "\n"; |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 749 | if (mConsoleMessages == null) { |
| 750 | mConsoleMessages = new StringBuffer(); |
| 751 | } |
Guang Zhu | 6c15f60 | 2010-05-03 11:49:04 -0700 | [diff] [blame] | 752 | mConsoleMessages.append(msg); |
| 753 | Log.v(LOGTAG, "LOG: " + msg); |
| 754 | // the rationale here is that if there's an error of either type, and the test was |
| 755 | // waiting for "notifyDone" signal to finish, then there's no point in waiting |
| 756 | // anymore because the JS execution is already terminated at this point and a |
| 757 | // "notifyDone" will never come out so it's just wasting time till timeout kicks in |
Guang Zhu | 5d53c19 | 2010-07-14 17:17:54 -0700 | [diff] [blame] | 758 | if ((msg.contains("Uncaught ReferenceError:") || msg.contains("Uncaught TypeError:")) |
| 759 | && mWaitUntilDone && mStopOnRefError) { |
Guang Zhu | 6c15f60 | 2010-05-03 11:49:04 -0700 | [diff] [blame] | 760 | Log.w(LOGTAG, "Terminating test case on uncaught ReferenceError or TypeError."); |
| 761 | mHandler.postDelayed(new Runnable() { |
| 762 | public void run() { |
| 763 | notifyDone(); |
| 764 | } |
| 765 | }, 500); |
| 766 | } |
| 767 | return true; |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 768 | } |
| 769 | |
| 770 | @Override |
| 771 | public boolean onCreateWindow(WebView view, boolean dialog, |
| 772 | boolean userGesture, Message resultMsg) { |
| 773 | if (!mCanOpenWindows) { |
Ben Murdoch | fc4a69e | 2010-02-04 16:35:10 +0000 | [diff] [blame] | 774 | // We can't open windows, so just send null back. |
| 775 | WebView.WebViewTransport transport = |
| 776 | (WebView.WebViewTransport) resultMsg.obj; |
| 777 | transport.setWebView(null); |
| 778 | resultMsg.sendToTarget(); |
| 779 | return true; |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 780 | } |
| 781 | |
| 782 | // We never display the new window, just create the view and |
| 783 | // allow it's content to execute and be recorded by the test |
| 784 | // runner. |
| 785 | |
Andrei Popescu | 4950b2b | 2009-09-03 13:56:07 +0100 | [diff] [blame] | 786 | HashMap<String, Object> jsIfaces = new HashMap<String, Object>(); |
| 787 | jsIfaces.put("layoutTestController", mCallbackProxy); |
| 788 | jsIfaces.put("eventSender", mCallbackProxy); |
| 789 | WebView newWindowView = new NewWindowWebView(TestShellActivity.this, jsIfaces); |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 790 | setupWebViewForLayoutTests(newWindowView, mCallbackProxy); |
| 791 | WebView.WebViewTransport transport = |
| 792 | (WebView.WebViewTransport) resultMsg.obj; |
| 793 | transport.setWebView(newWindowView); |
| 794 | resultMsg.sendToTarget(); |
| 795 | return true; |
| 796 | } |
Ben Murdoch | fc4a69e | 2010-02-04 16:35:10 +0000 | [diff] [blame] | 797 | |
| 798 | @Override |
| 799 | public void onCloseWindow(WebView view) { |
| 800 | view.destroy(); |
| 801 | } |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 802 | }; |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 803 | |
Andrei Popescu | 4950b2b | 2009-09-03 13:56:07 +0100 | [diff] [blame] | 804 | private static class NewWindowWebView extends WebView { |
| 805 | public NewWindowWebView(Context context, Map<String, Object> jsIfaces) { |
Elliott Slaughter | f21d2e3 | 2010-07-14 18:08:54 -0700 | [diff] [blame] | 806 | super(context, null, 0, jsIfaces, false); |
Andrei Popescu | 4950b2b | 2009-09-03 13:56:07 +0100 | [diff] [blame] | 807 | } |
| 808 | } |
| 809 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 810 | private void resetTestStatus() { |
| 811 | mWaitUntilDone = false; |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 812 | mDumpDataType = mDefaultDumpDataType; |
Shimeng (Simon) Wang | ad45686 | 2010-06-16 17:32:24 -0700 | [diff] [blame] | 813 | mDumpTopFrameAsText = false; |
| 814 | mDumpChildFramesAsText = false; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 815 | mTimedOut = false; |
| 816 | mDumpTitleChanges = false; |
| 817 | mRequestedWebKitData = false; |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 818 | mDumpDatabaseCallbacks = false; |
| 819 | mCanOpenWindows = false; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 820 | mEventSender.resetMouse(); |
Ben Murdoch | ecbc65c | 2010-01-13 10:54:56 +0000 | [diff] [blame] | 821 | mEventSender.clearTouchPoints(); |
Ben Murdoch | 8a032a3 | 2010-02-02 18:20:11 +0000 | [diff] [blame] | 822 | mEventSender.clearTouchMetaState(); |
Ben Murdoch | 2eea5f3 | 2009-09-23 15:28:57 +0100 | [diff] [blame] | 823 | mPageFinished = false; |
Ben Murdoch | 2eea5f3 | 2009-09-23 15:28:57 +0100 | [diff] [blame] | 824 | mDumpWebKitData = false; |
Guang Zhu | 5dc4f21 | 2009-10-29 18:24:54 -0700 | [diff] [blame] | 825 | mGetDrawtime = false; |
| 826 | mSaveImagePath = null; |
Ben Murdoch | a8b9768 | 2010-04-15 12:20:48 -0700 | [diff] [blame] | 827 | setDefaultWebSettings(mWebView); |
Steve Block | f0f30c6 | 2010-08-18 15:15:42 +0100 | [diff] [blame] | 828 | mIsGeolocationPermissionSet = false; |
| 829 | mPendingGeolocationPermissionCallbacks = null; |
Ben Murdoch | 7e73ce9 | 2011-01-20 11:21:24 +0000 | [diff] [blame] | 830 | CookieManager.getInstance().removeAllCookie(); |
Guang Zhu | 5dc4f21 | 2009-10-29 18:24:54 -0700 | [diff] [blame] | 831 | } |
| 832 | |
| 833 | private long[] getDrawWebViewTime(WebView view, int count) { |
| 834 | if (count == 0) |
| 835 | return null; |
| 836 | long[] ret = new long[count]; |
| 837 | long start; |
| 838 | Canvas canvas = new Canvas(); |
| 839 | Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Config.ARGB_8888); |
| 840 | canvas.setBitmap(bitmap); |
| 841 | for (int i = 0; i < count; i++) { |
| 842 | start = System.currentTimeMillis(); |
| 843 | view.draw(canvas); |
| 844 | ret[i] = System.currentTimeMillis() - start; |
| 845 | } |
| 846 | return ret; |
| 847 | } |
| 848 | |
| 849 | private void drawPageToFile(String fileName, WebView view) { |
| 850 | Canvas canvas = new Canvas(); |
| 851 | Bitmap bitmap = Bitmap.createBitmap(view.getContentWidth(), view.getContentHeight(), |
| 852 | Config.ARGB_8888); |
| 853 | canvas.setBitmap(bitmap); |
| 854 | view.drawPage(canvas); |
| 855 | try { |
| 856 | FileOutputStream fos = new FileOutputStream(fileName); |
| 857 | if(!bitmap.compress(CompressFormat.PNG, 90, fos)) { |
| 858 | Log.w(LOGTAG, "Failed to compress and save image."); |
| 859 | } |
| 860 | } catch (IOException ioe) { |
| 861 | Log.e(LOGTAG, "", ioe); |
| 862 | } |
| 863 | bitmap.recycle(); |
Ben Murdoch | 2eea5f3 | 2009-09-23 15:28:57 +0100 | [diff] [blame] | 864 | } |
| 865 | |
| 866 | private boolean canMoveToNextTest() { |
Ben Murdoch | 1620bcd | 2010-06-03 11:51:54 +0100 | [diff] [blame] | 867 | return (mDumpWebKitData && mPageFinished && !mWaitUntilDone) || mTimedOut; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 868 | } |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 869 | |
| 870 | private void setupWebViewForLayoutTests(WebView webview, CallbackProxy callbackProxy) { |
| 871 | if (webview == null) { |
| 872 | return; |
| 873 | } |
| 874 | |
Ben Murdoch | a8b9768 | 2010-04-15 12:20:48 -0700 | [diff] [blame] | 875 | setDefaultWebSettings(webview); |
| 876 | |
| 877 | webview.setWebChromeClient(mChromeClient); |
| 878 | webview.setWebViewClient(mViewClient); |
| 879 | // Setting a touch interval of -1 effectively disables the optimisation in WebView |
| 880 | // that stops repeated touch events flooding WebCore. The Event Sender only sends a |
| 881 | // single event rather than a stream of events (like what would generally happen in |
| 882 | // a real use of touch events in a WebView) and so if the WebView drops the event, |
| 883 | // the test will fail as the test expects one callback for every touch it synthesizes. |
| 884 | webview.setTouchInterval(-1); |
| 885 | } |
| 886 | |
| 887 | public void setDefaultWebSettings(WebView webview) { |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 888 | WebSettings settings = webview.getSettings(); |
Guang Zhu | f4bf552 | 2009-07-23 14:19:35 -0700 | [diff] [blame] | 889 | settings.setAppCacheEnabled(true); |
| 890 | settings.setAppCachePath(getApplicationContext().getCacheDir().getPath()); |
| 891 | settings.setAppCacheMaxSize(Long.MAX_VALUE); |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 892 | settings.setJavaScriptEnabled(true); |
| 893 | settings.setJavaScriptCanOpenWindowsAutomatically(true); |
| 894 | settings.setSupportMultipleWindows(true); |
| 895 | settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL); |
| 896 | settings.setDatabaseEnabled(true); |
| 897 | settings.setDatabasePath(getDir("databases",0).getAbsolutePath()); |
| 898 | settings.setDomStorageEnabled(true); |
Guang Zhu | b028f92 | 2009-08-11 14:27:32 -0700 | [diff] [blame] | 899 | settings.setWorkersEnabled(false); |
Elliott Slaughter | be1304f | 2010-06-23 11:29:02 -0700 | [diff] [blame] | 900 | settings.setXSSAuditorEnabled(false); |
Steve Block | 5f37cc43 | 2010-10-13 18:44:31 +0100 | [diff] [blame] | 901 | settings.setPageCacheCapacity(0); |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 902 | } |
| 903 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 904 | private WebView mWebView; |
| 905 | private WebViewEventSender mEventSender; |
| 906 | private AsyncHandler mHandler; |
| 907 | private TestShellCallback mCallback; |
| 908 | |
| 909 | private CallbackProxy mCallbackProxy; |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 910 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 911 | private String mTestUrl; |
| 912 | private String mResultFile; |
| 913 | private int mTimeoutInMillis; |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 914 | private String mUiAutoTestPath; |
Guang Zhu | 5dc4f21 | 2009-10-29 18:24:54 -0700 | [diff] [blame] | 915 | private String mSaveImagePath; |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 916 | private BufferedReader mTestListReader; |
Guang Zhu | 5dc4f21 | 2009-10-29 18:24:54 -0700 | [diff] [blame] | 917 | private boolean mGetDrawtime; |
Ben Murdoch | 9b815d0 | 2010-06-01 18:45:10 +0100 | [diff] [blame] | 918 | private int mTotalTestCount; |
| 919 | private int mCurrentTestNumber; |
Guang Zhu | 5d53c19 | 2010-07-14 17:17:54 -0700 | [diff] [blame] | 920 | private boolean mStopOnRefError; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 921 | |
| 922 | // States |
| 923 | private boolean mTimedOut; |
| 924 | private boolean mRequestedWebKitData; |
| 925 | private boolean mFinishedRunning; |
| 926 | |
| 927 | // Layout test controller variables. |
Guang Zhu | 1871fe0 | 2009-04-29 14:49:03 -0700 | [diff] [blame] | 928 | private DumpDataType mDumpDataType; |
| 929 | private DumpDataType mDefaultDumpDataType = DumpDataType.EXT_REPR; |
Shimeng (Simon) Wang | ad45686 | 2010-06-16 17:32:24 -0700 | [diff] [blame] | 930 | private boolean mDumpTopFrameAsText; |
| 931 | private boolean mDumpChildFramesAsText; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 932 | private boolean mWaitUntilDone; |
| 933 | private boolean mDumpTitleChanges; |
| 934 | private StringBuffer mTitleChanges; |
| 935 | private StringBuffer mDialogStrings; |
| 936 | private boolean mKeepWebHistory; |
| 937 | private Vector mWebHistory; |
Ben Murdoch | e6f3e45 | 2009-04-22 16:02:31 +0100 | [diff] [blame] | 938 | private boolean mDumpDatabaseCallbacks; |
| 939 | private StringBuffer mDatabaseCallbackStrings; |
| 940 | private StringBuffer mConsoleMessages; |
| 941 | private boolean mCanOpenWindows; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 942 | |
Ben Murdoch | 2eea5f3 | 2009-09-23 15:28:57 +0100 | [diff] [blame] | 943 | private boolean mPageFinished = false; |
| 944 | private boolean mDumpWebKitData = false; |
Ben Murdoch | 977f769 | 2009-09-16 20:13:07 +0100 | [diff] [blame] | 945 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 946 | static final String TIMEOUT_STR = "**Test timeout"; |
Steve Block | 8e8cf73 | 2011-02-10 10:51:45 -0800 | [diff] [blame] | 947 | static final long DUMP_TIMEOUT_MS = 100000; // 100s timeout for dumping webview content |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 948 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 949 | static final int MSG_TIMEOUT = 0; |
| 950 | static final int MSG_WEBKIT_DATA = 1; |
Guang Zhu | f37a574 | 2010-12-23 14:37:31 -0800 | [diff] [blame] | 951 | static final int MSG_DUMP_TIMEOUT = 2; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 952 | |
| 953 | static final String LOGTAG="TestShell"; |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 954 | |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 955 | static final String TEST_URL = "TestUrl"; |
| 956 | static final String RESULT_FILE = "ResultFile"; |
| 957 | static final String TIMEOUT_IN_MILLIS = "TimeoutInMillis"; |
Guang Zhu | f92bd42 | 2009-06-29 10:40:55 -0700 | [diff] [blame] | 958 | static final String UI_AUTO_TEST = "UiAutoTest"; |
Guang Zhu | 5dc4f21 | 2009-10-29 18:24:54 -0700 | [diff] [blame] | 959 | static final String GET_DRAW_TIME = "GetDrawTime"; |
| 960 | static final String SAVE_IMAGE = "SaveImage"; |
Ben Murdoch | 9b815d0 | 2010-06-01 18:45:10 +0100 | [diff] [blame] | 961 | static final String TOTAL_TEST_COUNT = "TestCount"; |
| 962 | static final String CURRENT_TEST_NUMBER = "TestNumber"; |
Guang Zhu | 5d53c19 | 2010-07-14 17:17:54 -0700 | [diff] [blame] | 963 | static final String STOP_ON_REF_ERROR = "StopOnReferenceError"; |
Guang Zhu | 5dc4f21 | 2009-10-29 18:24:54 -0700 | [diff] [blame] | 964 | |
| 965 | static final int DRAW_RUNS = 5; |
Christian Mehlmauer | 8b85dce | 2010-07-19 20:11:27 +0200 | [diff] [blame] | 966 | static final String DRAW_TIME_LOG = Environment.getExternalStorageDirectory() + |
| 967 | "/android/page_draw_time.txt"; |
Steve Block | dad347c | 2009-08-19 18:46:34 +0100 | [diff] [blame] | 968 | |
Steve Block | f0f30c6 | 2010-08-18 15:15:42 +0100 | [diff] [blame] | 969 | private boolean mIsGeolocationPermissionSet; |
Steve Block | dad347c | 2009-08-19 18:46:34 +0100 | [diff] [blame] | 970 | private boolean mGeolocationPermission; |
Steve Block | f0f30c6 | 2010-08-18 15:15:42 +0100 | [diff] [blame] | 971 | private Map mPendingGeolocationPermissionCallbacks; |
The Android Open Source Project | ba87e3e | 2009-03-13 13:04:22 -0700 | [diff] [blame] | 972 | } |