diff options
author | Guang Zhu <guangzhu@google.com> | 2010-12-13 14:16:10 -0800 |
---|---|---|
committer | Guang Zhu <guangzhu@google.com> | 2010-12-13 14:16:10 -0800 |
commit | afdb794ba4a05716dfc52be7c4d3885fb4174d4a (patch) | |
tree | e08b9e8fe4ed2d70b35b928eff223794c52e3d1f /tests | |
parent | 479baf93afd1539e082eb99268ac96b29a60db9a (diff) | |
download | packages_apps_Browser-afdb794ba4a05716dfc52be7c4d3885fb4174d4a.zip packages_apps_Browser-afdb794ba4a05716dfc52be7c4d3885fb4174d4a.tar.gz packages_apps_Browser-afdb794ba4a05716dfc52be7c4d3885fb4174d4a.tar.bz2 |
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
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/browser/PopularUrlsTest.java | 8 |
1 files changed, 8 insertions, 0 deletions
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 @@ public class PopularUrlsTest extends ActivityInstrumentationTestCase2<BrowserAct } } + @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() { |