Index: android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java |
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java |
index c868d2de4bc35338b2288259a93d95acd2e15ad5..a9f4cdded7f64eabd4af423ad40355e69c72991a 100644 |
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java |
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java |
@@ -1946,15 +1946,10 @@ public class AwSettingsTest extends AndroidWebViewTestBase { |
final AwTestContainerView testContainerView = |
createAwTestContainerViewOnMainSync(contentClient); |
final AwContents awContents = testContainerView.getAwContents(); |
- try { |
- useTestResourceContext(); |
- loadUrlSync(awContents, |
- contentClient.getOnPageFinishedHelper(), |
- "file:///android_asset/asset_file.html"); |
- assertEquals(expectedTitle, getTitleOnUiThread(awContents)); |
- } finally { |
- resetResourceContext(); |
- } |
+ loadUrlSync(awContents, |
+ contentClient.getOnPageFinishedHelper(), |
+ "file:///android_asset/asset_file.html"); |
+ assertEquals(expectedTitle, getTitleOnUiThread(awContents)); |
} |
// Test a resource URL (file:///android_res/). |
@@ -1968,15 +1963,10 @@ public class AwSettingsTest extends AndroidWebViewTestBase { |
final AwTestContainerView testContainerView = |
createAwTestContainerViewOnMainSync(contentClient); |
final AwContents awContents = testContainerView.getAwContents(); |
- try { |
- useTestResourceContext(); |
- loadUrlSync(awContents, |
- contentClient.getOnPageFinishedHelper(), |
- "file:///android_res/raw/resource_file.html"); |
- assertEquals(expectedTitle, getTitleOnUiThread(awContents)); |
- } finally { |
- resetResourceContext(); |
- } |
+ loadUrlSync(awContents, |
+ contentClient.getOnPageFinishedHelper(), |
+ "file:///android_res/raw/resource_file.html"); |
+ assertEquals(expectedTitle, getTitleOnUiThread(awContents)); |
} |
// Test that the file URL access toggle does not affect asset URLs. |
@@ -1991,16 +1981,11 @@ public class AwSettingsTest extends AndroidWebViewTestBase { |
createAwTestContainerViewOnMainSync(contentClient); |
final AwContents awContents = testContainerView.getAwContents(); |
final AwSettings settings = getAwSettingsOnUiThread(awContents); |
- try { |
- useTestResourceContext(); |
- settings.setAllowFileAccess(false); |
- loadUrlSync(awContents, |
- contentClient.getOnPageFinishedHelper(), |
- "file:///android_asset/asset_file.html"); |
- assertEquals(expectedTitle, getTitleOnUiThread(awContents)); |
- } finally { |
- resetResourceContext(); |
- } |
+ settings.setAllowFileAccess(false); |
+ loadUrlSync(awContents, |
+ contentClient.getOnPageFinishedHelper(), |
+ "file:///android_asset/asset_file.html"); |
+ assertEquals(expectedTitle, getTitleOnUiThread(awContents)); |
} |
// Test that the file URL access toggle does not affect resource URLs. |
@@ -2015,16 +2000,11 @@ public class AwSettingsTest extends AndroidWebViewTestBase { |
createAwTestContainerViewOnMainSync(contentClient); |
final AwContents awContents = testContainerView.getAwContents(); |
final AwSettings settings = getAwSettingsOnUiThread(awContents); |
- try { |
- useTestResourceContext(); |
- settings.setAllowFileAccess(false); |
- loadUrlSync(awContents, |
- contentClient.getOnPageFinishedHelper(), |
- "file:///android_res/raw/resource_file.html"); |
- assertEquals(expectedTitle, getTitleOnUiThread(awContents)); |
- } finally { |
- resetResourceContext(); |
- } |
+ settings.setAllowFileAccess(false); |
+ loadUrlSync(awContents, |
+ contentClient.getOnPageFinishedHelper(), |
+ "file:///android_res/raw/resource_file.html"); |
+ assertEquals(expectedTitle, getTitleOnUiThread(awContents)); |
} |
@SmallTest |
@@ -2557,7 +2537,7 @@ public class AwSettingsTest extends AndroidWebViewTestBase { |
observer.register(awContents.getContentViewCore(), "javaObserver"); |
} |
}); |
- VideoTestWebServer webServer = new VideoTestWebServer(getInstrumentation().getContext()); |
+ VideoTestWebServer webServer = new VideoTestWebServer(getActivity()); |
try { |
String data = "<html><head><script>" + |
"addEventListener('DOMContentLoaded', function() { " + |
@@ -2618,7 +2598,8 @@ public class AwSettingsTest extends AndroidWebViewTestBase { |
contentSettings.setDefaultVideoPosterURL(DEFAULT_VIDEO_POSTER_URL); |
} |
}); |
- VideoTestWebServer webServer = new VideoTestWebServer(getInstrumentation().getContext()); |
+ VideoTestWebServer webServer = new VideoTestWebServer( |
+ getInstrumentation().getTargetContext()); |
try { |
String data = "<html><head><body>" + |
"<video id='video' control src='" + |
@@ -2742,21 +2723,6 @@ public class AwSettingsTest extends AndroidWebViewTestBase { |
} |
/** |
- * Configure the browser to load resources from the test harness instead of the browser |
- * application. |
- */ |
- private void useTestResourceContext() { |
- AndroidProtocolHandler.setResourceContextForTesting(getInstrumentation().getContext()); |
- } |
- |
- /** |
- * Configure the browser to load resources from the browser application. |
- */ |
- private void resetResourceContext() { |
- AndroidProtocolHandler.setResourceContextForTesting(null); |
- } |
- |
- /** |
* Returns pure page scale. |
*/ |
private float getScaleOnUiThread(final AwContents awContents) throws Throwable { |