Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2311)

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/ClientOnReceivedErrorTest.java

Issue 12609013: [android_webview] Build test code against the shell APK. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix up minsdkversoin Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
}
}

Powered by Google App Engine
This is Rietveld 408576698