summaryrefslogtreecommitdiffstats
path: root/tests/DumpRenderTree
diff options
context:
space:
mode:
authorGuang Zhu <guangzhu@google.com>2010-12-23 14:37:31 -0800
committerGuang Zhu <guangzhu@google.com>2010-12-23 14:37:31 -0800
commitf37a574f1cf9085d103f8663cef5f29de29e2ec9 (patch)
tree506cb72e9427869ef3e3a9b966855ee4d3724309 /tests/DumpRenderTree
parent8fb9eeb27f36ce6110142c417b0cdf8da2a6280c (diff)
downloadframeworks_base-f37a574f1cf9085d103f8663cef5f29de29e2ec9.zip
frameworks_base-f37a574f1cf9085d103f8663cef5f29de29e2ec9.tar.gz
frameworks_base-f37a574f1cf9085d103f8663cef5f29de29e2ec9.tar.bz2
Throw exception if webview dump times out
if a webview dump times out, normally it's already in a bad state, throwing runtime execption will generate a crash on the test case and make the test move forward. Change-Id: Id7430700db6b6d90160d60d23debd250b1731789
Diffstat (limited to 'tests/DumpRenderTree')
-rw-r--r--tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java
index 643dbf5..d9b67ea 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java
@@ -88,8 +88,9 @@ public class TestShellActivity extends Activity implements LayoutTestController
} else if (msg.what == MSG_WEBKIT_DATA) {
TestShellActivity.this.dump(mTimedOut, (String)msg.obj);
return;
+ } else if (msg.what == MSG_DUMP_TIMEOUT) {
+ throw new RuntimeException("WebView dump timeout, is it pegged?");
}
-
super.handleMessage(msg);
}
}
@@ -106,10 +107,12 @@ public class TestShellActivity extends Activity implements LayoutTestController
case DUMP_AS_TEXT:
callback.arg1 = mDumpTopFrameAsText ? 1 : 0;
callback.arg2 = mDumpChildFramesAsText ? 1 : 0;
+ setDumpTimeout(DUMP_TIMEOUT_MS);
mWebView.documentAsText(callback);
break;
case EXT_REPR:
mWebView.externalRepresentation(callback);
+ setDumpTimeout(DUMP_TIMEOUT_MS);
break;
default:
finished();
@@ -117,6 +120,11 @@ public class TestShellActivity extends Activity implements LayoutTestController
}
}
+ private void setDumpTimeout(long timeout) {
+ Message msg = mHandler.obtainMessage(MSG_DUMP_TIMEOUT);
+ mHandler.sendMessageDelayed(msg, timeout);
+ }
+
public void clearCache() {
mWebView.freeMemory();
}
@@ -933,9 +941,11 @@ public class TestShellActivity extends Activity implements LayoutTestController
private boolean mDumpWebKitData = false;
static final String TIMEOUT_STR = "**Test timeout";
+ static final long DUMP_TIMEOUT_MS = 20000; //20s timeout for dumping webview content
static final int MSG_TIMEOUT = 0;
static final int MSG_WEBKIT_DATA = 1;
+ static final int MSG_DUMP_TIMEOUT = 2;
static final String LOGTAG="TestShell";