prevent browser test from launching non-http urls
some websites may trigger the browser to launch a non-http url.
typical case is that some website saw the client is Android, then
launch a market search urln to promote their native app.
Change-Id: I7785f66c8516a95597fd264b88f130008c309618
diff --git a/tests/src/com/android/browser/PopularUrlsTest.java b/tests/src/com/android/browser/PopularUrlsTest.java
index 86ce94d..e407194 100644
--- a/tests/src/com/android/browser/PopularUrlsTest.java
+++ b/tests/src/com/android/browser/PopularUrlsTest.java
@@ -247,6 +247,14 @@
}
}
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ if (!(url.startsWith("http://") || url.startsWith("https://"))) {
+ Log.v(TAG, String.format("suppressing non-http url scheme: %s", url));
+ return true;
+ }
+ return super.shouldOverrideUrlLoading(view, url);
+ }
});
webView.setDownloadListener(new DownloadListener() {