summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android
diff options
context:
space:
mode:
authorGuang Zhu <guangzhu@google.com>2010-12-10 19:38:46 -0800
committerGuang Zhu <guangzhu@google.com>2010-12-10 19:42:54 -0800
commit39e1cbdbc5f20314fe4ae48b85aa37a8e0b2f128 (patch)
tree329ca1355f14ed003e80fb1d8a0f979b6c9184a6 /tests/src/com/android
parent0ebd3ac69a76ec76d9caab65a1947f971242994e (diff)
downloadpackages_apps_browser-39e1cbdbc5f20314fe4ae48b85aa37a8e0b2f128.zip
packages_apps_browser-39e1cbdbc5f20314fe4ae48b85aa37a8e0b2f128.tar.gz
packages_apps_browser-39e1cbdbc5f20314fe4ae48b85aa37a8e0b2f128.tar.bz2
some improvements for browser test harness
* intercept JavaScript onUnload confirmation, no dialog shown * using null download manager to avoid actual downloading during random url test Change-Id: I41758a87a0c5de5b42d34db8a403bb6d6ca053b2
Diffstat (limited to 'tests/src/com/android')
-rw-r--r--tests/src/com/android/browser/PopularUrlsTest.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/src/com/android/browser/PopularUrlsTest.java b/tests/src/com/android/browser/PopularUrlsTest.java
index ac9a90e..86ce94d 100644
--- a/tests/src/com/android/browser/PopularUrlsTest.java
+++ b/tests/src/com/android/browser/PopularUrlsTest.java
@@ -17,7 +17,6 @@
package com.android.browser;
import android.app.Instrumentation;
-import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.net.http.SslError;
@@ -25,6 +24,7 @@ import android.os.Environment;
import android.test.ActivityInstrumentationTestCase2;
import android.text.TextUtils;
import android.util.Log;
+import android.webkit.DownloadListener;
import android.webkit.HttpAuthHandler;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
@@ -188,6 +188,16 @@ public class PopularUrlsTest extends ActivityInstrumentationTestCase2<BrowserAct
return true;
}
+
+ /*
+ * Skip the unload confirmation
+ */
+ @Override
+ public boolean onJsBeforeUnload(
+ WebView view, String url, String message, JsResult result) {
+ result.confirm();
+ return true;
+ }
});
webView.setWebViewClient(new TestWebViewClient(webView.getWebViewClient()) {
@@ -238,6 +248,15 @@ public class PopularUrlsTest extends ActivityInstrumentationTestCase2<BrowserAct
}
});
+
+ webView.setDownloadListener(new DownloadListener() {
+
+ @Override
+ public void onDownloadStart(String url, String userAgent, String contentDisposition,
+ String mimetype, long contentLength) {
+ Log.v(TAG, String.format("Download request ignored: %s", url));
+ }
+ });
}
void resetLatch() {