Remove WebView startup StrictMode CTS test and add NullWebView check
The WebView startup StrictMode test fails for Wear, and passes
incorrectly when run as part of a series of tests anyway so there is no
reason to keep it as is (if implemented correctly, or just run on its
own, it will fail for a non-wear device).
Also add NullWebView check to a WebView ServiceWorker test to early-out
if WebView is not available on the device.
Bug: 30119659
Change-Id: I2a60d02175c5085704285e570a93fe4dc00b57db
diff --git a/tests/tests/webkit/src/android/webkit/cts/ServiceWorkerClientTest.java b/tests/tests/webkit/src/android/webkit/cts/ServiceWorkerClientTest.java
index a77d648..e09e0d6 100644
--- a/tests/tests/webkit/src/android/webkit/cts/ServiceWorkerClientTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/ServiceWorkerClientTest.java
@@ -16,6 +16,7 @@
package android.webkit.cts;
+import android.cts.util.NullWebViewUtils;
import android.cts.util.PollingCheck;
import android.test.ActivityInstrumentationTestCase2;
@@ -136,6 +137,10 @@
// Test correct invocation of shouldInterceptRequest for Service Workers.
public void testServiceWorkerClientInterceptCallback() throws Exception {
+ if (!NullWebViewUtils.isWebViewAvailable()) {
+ return;
+ }
+
final InterceptServiceWorkerClient mInterceptServiceWorkerClient =
new InterceptServiceWorkerClient();
ServiceWorkerController swController = ServiceWorkerController.getInstance();
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewStartupTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewStartupTest.java
index a4ebaca..3b67d84 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewStartupTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewStartupTest.java
@@ -20,7 +20,6 @@
import android.content.Context;
import android.cts.util.NullWebViewUtils;
import android.cts.util.PollingCheck;
-import android.os.StrictMode;
import android.test.ActivityInstrumentationTestCase2;
import android.test.UiThreadTest;
import android.util.Log;
@@ -89,21 +88,4 @@
assertTrue(m.matches());
assertEquals("42", m.group(1)); // value got incremented
}
-
- @UiThreadTest
- public void testStrictModeNotViolatedOnStartup() throws Throwable {
- StrictMode.ThreadPolicy oldPolicy = StrictMode.getThreadPolicy();
- StrictMode.ThreadPolicy testPolicy = new StrictMode.ThreadPolicy.Builder()
- .detectDiskReads()
- .penaltyLog()
- .penaltyDeath()
- .build();
- StrictMode.setThreadPolicy(testPolicy);
- try {
- mActivity.createAndAttachWebView();
- } finally {
- StrictMode.setThreadPolicy(oldPolicy);
- }
- }
-
}