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

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

Issue 1882783002: [WebView] Disallow geolocation on insecure origins for apps targeting N and higher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/GeolocationTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/GeolocationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/GeolocationTest.java
index 54e07e369bb6dda25842a8353dbb16fd7f15e7b9..ab4419e04f77ca27d73af4ecdcafc1628909c646 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/GeolocationTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/GeolocationTest.java
@@ -297,4 +297,48 @@ public class GeolocationTest extends AwTestBase {
});
}
+ @Feature({"AndroidWebView"})
+ @SmallTest
+ public void testDenyOnInsecureOrigins() throws Throwable {
+ initAwContents(new GrantPermisionAwContentClient());
+ getInstrumentation().runOnMainSync(new Runnable() {
+ @Override
+ public void run() {
+ mAwContents.getSettings().setAllowGeolocationOnInsecureOriginsForTests(false);
+ }
+ });
+
+ loadDataWithBaseUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), RAW_HTML,
+ "text/html", false, "http://google.com/", "about:blank");
+
+ mAwContents.evaluateJavaScriptForTests("initiate_getCurrentPosition();", null);
+
+ pollInstrumentationThread(new Callable<Boolean>() {
+ @SuppressFBWarnings("DM_GC")
+ @Override
+ public Boolean call() throws Exception {
+ Runtime.getRuntime().gc();
+ return "deny".equals(getTitleOnUiThread(mAwContents));
+ }
+ });
+ }
+
+ @Feature({"AndroidWebView"})
+ @SmallTest
+ public void testAllowOnInsecureOriginsByDefault() throws Throwable {
+ initAwContents(new GrantPermisionAwContentClient());
+
+ loadDataWithBaseUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), RAW_HTML,
+ "text/html", false, "http://google.com/", "about:blank");
+
+ mAwContents.evaluateJavaScriptForTests("initiate_getCurrentPosition();", null);
+
+ pollInstrumentationThread(new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ return getPositionCountFromJS() > 0;
+ }
+ });
+ }
+
}

Powered by Google App Engine
This is Rietveld 408576698