diff options
author | Ben Murdoch <benm@google.com> | 2014-03-28 17:03:55 +0000 |
---|---|---|
committer | The Android Automerger <android-build@android.com> | 2014-04-01 15:13:20 -0700 |
commit | 1413e571090e5178548542b71daf40934deca930 (patch) | |
tree | 87235d604a95089fddb55f9403b97ce543efa756 | |
parent | 623851b2e6ea20f566e418c678b5d50cf6ae6d77 (diff) | |
download | platform_cts-1413e571090e5178548542b71daf40934deca930.tar.gz platform_cts-1413e571090e5178548542b71daf40934deca930.tar.bz2 platform_cts-1413e571090e5178548542b71daf40934deca930.zip |
Stabilise WebViewTest.testSetDownloadListener
Work around a bug in Blink/chromium compositor by posting the navigation
to the download URL in a setTimeout.
Bug: 13675265
Change-Id: I4105fd5f3cc30845e1ff10058b601355bf6ca903
-rw-r--r-- | tests/tests/webkit/src/android/webkit/cts/WebViewTest.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java index 9815aef4662..50c6747cb7c 100644 --- a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java +++ b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java @@ -1828,9 +1828,13 @@ public class WebViewTest extends ActivityInstrumentationTestCase2<WebViewStubAct // the WebView will load the new URL. mOnUiThread.setDownloadListener(listener); mOnUiThread.getSettings().setJavaScriptEnabled(true); + + // See b/13675265 for discussion on why the setTimeout is necessary. + // Works around a Blink bug. mOnUiThread.loadDataAndWaitForCompletion( - "<html><body onload=\"window.location = \'" + url + "\'\"></body></html>", - "text/html", null); + "<html><body onload=\"setTimeout(" + + "function() { window.location = \'" + url + "\'; }, 100);\">" + + "</body></html>", "text/html", null); // Wait for layout to complete before setting focus. getInstrumentation().waitForIdleSync(); |