Commit 54ef219a authored by Changwan Ryu's avatar Changwan Ryu Committed by Commit Bot

Add a test for window.origin

Check window.origin value for HTTPS-schemed base Uri vs
custom-schemed base Uri.

Bug: 896059
Change-Id: Ic310c584e0826d14683734f8e6190875dddcc28f
Reviewed-on: https://chromium-review.googlesource.com/c/1340821Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Changwan Ryu <changwan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608887}
parent 39402a68
......@@ -544,4 +544,31 @@ public class LoadDataWithBaseUrlTest {
RecordHistogram.getHistogramValueCountForTesting(
AwContents.DATA_BASE_URL_SCHEME_HISTOGRAM_NAME, expectedSchemeEnum));
}
@Test
@SmallTest
@Feature({"AndroidWebView"})
public void testWindowOriginForHttpSchemeUrl() throws Throwable {
String baseUri = "https://google.com";
AwSettings contentSettings = mActivityTestRule.getAwSettingsOnUiThread(mAwContents);
contentSettings.setJavaScriptEnabled(true);
loadDataWithBaseUrlSync("", "text/html", false, baseUri, null);
Assert.assertEquals("\"https://google.com\"",
mActivityTestRule.executeJavaScriptAndWaitForResult(
mAwContents, mContentsClient, "window.origin;"));
}
@Test
@SmallTest
@Feature({"AndroidWebView"})
public void testWindowOriginForCustomSchemeUrl() throws Throwable {
String baseUri = "x-thread://-86516399/2465766146407674724";
AwSettings contentSettings = mActivityTestRule.getAwSettingsOnUiThread(mAwContents);
contentSettings.setJavaScriptEnabled(true);
loadDataWithBaseUrlSync("", "text/html", false, baseUri, null);
// TODO(dcheng): https://crbug.com/896059 this should be fixed as "x-thread://".
Assert.assertEquals("\"null\"",
mActivityTestRule.executeJavaScriptAndWaitForResult(
mAwContents, mContentsClient, "window.origin;"));
}
}
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