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; |
+ } |
+ }); |
+ } |
+ |
} |