Merge "Part of fix for bug 8629392: CTS test failures" into jb-mr2-dev
diff --git a/tests/src/android/webkit/cts/WebViewOnUiThread.java b/tests/src/android/webkit/cts/WebViewOnUiThread.java
index cbda733..aef4374 100644
--- a/tests/src/android/webkit/cts/WebViewOnUiThread.java
+++ b/tests/src/android/webkit/cts/WebViewOnUiThread.java
@@ -182,6 +182,15 @@
});
}
+ public void setNetworkAvailable(final boolean available) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.setNetworkAvailable(available);
+ }
+ });
+ }
+
public void setDownloadListener(final DownloadListener listener) {
runOnUiThread(new Runnable() {
@Override
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
index 7acc3cd..0dab28b 100755
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
@@ -1616,7 +1616,7 @@
// WebViewClient.shouldOverrideUrlLoading() returns false, so
// the WebView will load the new URL.
mOnUiThread.setDownloadListener(listener);
- mWebView.getSettings().setJavaScriptEnabled(true);
+ mOnUiThread.getSettings().setJavaScriptEnabled(true);
mOnUiThread.loadDataAndWaitForCompletion(
"<html><body onload=\"window.location = \'" + url + "\'\"></body></html>",
"text/html", null);
@@ -1657,7 +1657,7 @@
mOnUiThread.loadUrlAndWaitForCompletion(url);
assertEquals("ONLINE", mOnUiThread.getTitle());
- mWebView.setNetworkAvailable(false);
+ mOnUiThread.setNetworkAvailable(false);
// Wait for the DOM to receive notification of the network state change.
new PollingCheck(TEST_TIMEOUT) {
@@ -1667,7 +1667,7 @@
}
}.run();
- mWebView.setNetworkAvailable(true);
+ mOnUiThread.setNetworkAvailable(true);
// Wait for the DOM to receive notification of the network state change.
new PollingCheck(TEST_TIMEOUT) {