diff options
author | Andrei Popescu <andreip@google.com> | 2009-09-03 13:56:07 +0100 |
---|---|---|
committer | Andrei Popescu <andreip@google.com> | 2009-09-03 22:31:55 +0100 |
commit | 4950b2b6951bbdc2b0023130bfbaca2a4044044f (patch) | |
tree | 5c90e85eab5236bf702a60307e9261f10365833e /tests/DumpRenderTree/src | |
parent | e131b7466c8b817896a618efe4b34eed5d3e51f9 (diff) | |
download | frameworks_base-4950b2b6951bbdc2b0023130bfbaca2a4044044f.zip frameworks_base-4950b2b6951bbdc2b0023130bfbaca2a4044044f.tar.gz frameworks_base-4950b2b6951bbdc2b0023130bfbaca2a4044044f.tar.bz2 |
Fix appcache layout test that was timing out due to race condition in WebView::addJavascriptInterface.
Diffstat (limited to 'tests/DumpRenderTree/src')
-rw-r--r-- | tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java index e342efb..663df83 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java @@ -18,6 +18,7 @@ package com.android.dumprendertree; import android.app.Activity; import android.app.AlertDialog; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.DialogInterface.OnClickListener; @@ -47,6 +48,8 @@ import java.io.FileReader; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import java.util.HashMap; +import java.util.Map; import java.util.Vector; public class TestShellActivity extends Activity implements LayoutTestController { @@ -107,6 +110,8 @@ public class TestShellActivity extends Activity implements LayoutTestController mEventSender = new WebViewEventSender(mWebView); mCallbackProxy = new CallbackProxy(mEventSender, this); + mWebView.addJavascriptInterface(mCallbackProxy, "layoutTestController"); + mWebView.addJavascriptInterface(mCallbackProxy, "eventSender"); setupWebViewForLayoutTests(mWebView, mCallbackProxy); contentView.addView(mWebView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, 0.0f)); @@ -620,7 +625,10 @@ public class TestShellActivity extends Activity implements LayoutTestController // allow it's content to execute and be recorded by the test // runner. - WebView newWindowView = new WebView(TestShellActivity.this); + HashMap<String, Object> jsIfaces = new HashMap<String, Object>(); + jsIfaces.put("layoutTestController", mCallbackProxy); + jsIfaces.put("eventSender", mCallbackProxy); + WebView newWindowView = new NewWindowWebView(TestShellActivity.this, jsIfaces); setupWebViewForLayoutTests(newWindowView, mCallbackProxy); WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj; @@ -630,6 +638,12 @@ public class TestShellActivity extends Activity implements LayoutTestController } }; + private static class NewWindowWebView extends WebView { + public NewWindowWebView(Context context, Map<String, Object> jsIfaces) { + super(context, null, 0, jsIfaces); + } + } + private void resetTestStatus() { mWaitUntilDone = false; mDumpDataType = mDefaultDumpDataType; @@ -659,9 +673,6 @@ public class TestShellActivity extends Activity implements LayoutTestController settings.setDomStorageEnabled(true); settings.setWorkersEnabled(false); - webview.addJavascriptInterface(callbackProxy, "layoutTestController"); - webview.addJavascriptInterface(callbackProxy, "eventSender"); - webview.setWebChromeClient(mChromeClient); webview.setWebViewClient(mViewClient); } |