Index: android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java |
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java |
index bb101365452da621277edcfe4d728c15a9cda27e..38b3275e9a8e3605e4c5ba93b6497ed530d3245c 100644 |
--- a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java |
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java |
@@ -92,20 +92,15 @@ public class ClientOnReceivedErrorTest extends AndroidWebViewTestBase { |
public void testNonExistentAssetUrl() throws Throwable { |
TestCallbackHelperContainer.OnReceivedErrorHelper onReceivedErrorHelper = |
mContentsClient.getOnReceivedErrorHelper(); |
- try { |
- final String url = "file:///android_asset/does_not_exist.html"; |
- int onReceivedErrorCallCount = onReceivedErrorHelper.getCallCount(); |
- useTestResourceContext(); |
- loadUrlAsync(mAwContents, url); |
- |
- onReceivedErrorHelper.waitForCallback(onReceivedErrorCallCount); |
- assertEquals(ErrorCodeConversionHelper.ERROR_UNKNOWN, |
- onReceivedErrorHelper.getErrorCode()); |
- assertEquals(url, onReceivedErrorHelper.getFailingUrl()); |
- assertNotNull(onReceivedErrorHelper.getDescription()); |
- } finally { |
- resetResourceContext(); |
- } |
+ final String url = "file:///android_asset/does_not_exist.html"; |
+ int onReceivedErrorCallCount = onReceivedErrorHelper.getCallCount(); |
+ loadUrlAsync(mAwContents, url); |
+ |
+ onReceivedErrorHelper.waitForCallback(onReceivedErrorCallCount); |
+ assertEquals(ErrorCodeConversionHelper.ERROR_UNKNOWN, |
+ onReceivedErrorHelper.getErrorCode()); |
+ assertEquals(url, onReceivedErrorHelper.getFailingUrl()); |
+ assertNotNull(onReceivedErrorHelper.getDescription()); |
} |
@MediumTest |
@@ -113,34 +108,14 @@ public class ClientOnReceivedErrorTest extends AndroidWebViewTestBase { |
public void testNonExistentResourceUrl() throws Throwable { |
TestCallbackHelperContainer.OnReceivedErrorHelper onReceivedErrorHelper = |
mContentsClient.getOnReceivedErrorHelper(); |
- try { |
- final String url = "file:///android_res/raw/does_not_exist.html"; |
- int onReceivedErrorCallCount = onReceivedErrorHelper.getCallCount(); |
- useTestResourceContext(); |
- loadUrlAsync(mAwContents, url); |
- |
- onReceivedErrorHelper.waitForCallback(onReceivedErrorCallCount); |
- assertEquals(ErrorCodeConversionHelper.ERROR_UNKNOWN, |
- onReceivedErrorHelper.getErrorCode()); |
- assertEquals(url, onReceivedErrorHelper.getFailingUrl()); |
- assertNotNull(onReceivedErrorHelper.getDescription()); |
- } finally { |
- resetResourceContext(); |
- } |
- } |
- |
- /** |
- * Configure the browser to load resources from the test harness instead of the browser |
- * application. |
- */ |
- private void useTestResourceContext() { |
- AndroidProtocolHandler.setResourceContextForTesting(getInstrumentation().getContext()); |
- } |
+ final String url = "file:///android_res/raw/does_not_exist.html"; |
+ int onReceivedErrorCallCount = onReceivedErrorHelper.getCallCount(); |
+ loadUrlAsync(mAwContents, url); |
- /** |
- * Configure the browser to load resources from the browser application. |
- */ |
- private void resetResourceContext() { |
- AndroidProtocolHandler.setResourceContextForTesting(null); |
+ onReceivedErrorHelper.waitForCallback(onReceivedErrorCallCount); |
+ assertEquals(ErrorCodeConversionHelper.ERROR_UNKNOWN, |
+ onReceivedErrorHelper.getErrorCode()); |
+ assertEquals(url, onReceivedErrorHelper.getFailingUrl()); |
+ assertNotNull(onReceivedErrorHelper.getDescription()); |
} |
} |