Commit a1c89026 authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

weblayer: adds strictmode for WebViewCompatibilityTest

Loading WebView loads from disk.

BUG=1062554
TEST=test only change

Change-Id: I156a8df429cce7b3f88827ed432ce1d3581c98ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2109132Reviewed-by: default avatarClark DuVall <cduvall@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751508}
parent a9afce0b
...@@ -13,6 +13,7 @@ import org.junit.Rule; ...@@ -13,6 +13,7 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.StrictModeContext;
import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CallbackHelper;
import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.weblayer.WebLayer; import org.chromium.weblayer.WebLayer;
...@@ -35,8 +36,12 @@ public class WebViewCompatibilityTest { ...@@ -35,8 +36,12 @@ public class WebViewCompatibilityTest {
InstrumentationRegistry.getTargetContext().getApplicationContext()); InstrumentationRegistry.getTargetContext().getApplicationContext());
}); });
mActivityTestRule.launchShellWithUrl(mActivityTestRule.getTestDataURL("simple_page.html")); mActivityTestRule.launchShellWithUrl(mActivityTestRule.getTestDataURL("simple_page.html"));
WebView webView = TestThreadUtils.runOnUiThreadBlocking( WebView webView = TestThreadUtils.runOnUiThreadBlocking(() -> {
() -> { return new WebView(mActivityTestRule.getActivity()); }); // Loading WebView triggers loading from disk.
try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) {
return new WebView(mActivityTestRule.getActivity());
}
});
CallbackHelper callbackHelper = new CallbackHelper(); CallbackHelper callbackHelper = new CallbackHelper();
TestThreadUtils.runOnUiThreadBlocking(() -> { TestThreadUtils.runOnUiThreadBlocking(() -> {
webView.setWebViewClient(new WebViewClient() { webView.setWebViewClient(new WebViewClient() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment