diff options
author | Guang Zhu <guangzhu@google.com> | 2010-05-03 11:49:04 -0700 |
---|---|---|
committer | Guang Zhu <guangzhu@google.com> | 2010-05-03 11:49:04 -0700 |
commit | 6c15f6003a69e664f132342be2252a77e480495b (patch) | |
tree | 64369e1f35226370311bb8b819b957f5e2b1dcdc /tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java | |
parent | edd904fd317838c526b16d983af22d5a3dc1cd3b (diff) |
improvements on layout test
* reduce timeout limit from 30s to 15s
* terminate a test case under some condition on uncaught JS exception
* minor fixes
Change-Id: Iabc8f214544d2c8c14139756abc049870023fea5
Diffstat (limited to 'tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java')
-rw-r--r-- | tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java index ec8a8df37103..2b1a7811ad41 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java @@ -34,6 +34,7 @@ import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.ViewGroup; +import android.webkit.ConsoleMessage; import android.webkit.GeolocationPermissions; import android.webkit.HttpAuthHandler; import android.webkit.JsPromptResult; @@ -675,15 +676,28 @@ public class TestShellActivity extends Activity implements LayoutTestController } @Override - public void onConsoleMessage(String message, int lineNumber, - String sourceID) { + public boolean onConsoleMessage(ConsoleMessage consoleMessage) { + String msg = "CONSOLE MESSAGE: line " + consoleMessage.lineNumber() + ": " + + consoleMessage.message() + "\n"; if (mConsoleMessages == null) { mConsoleMessages = new StringBuffer(); } - String consoleMessage = "CONSOLE MESSAGE: line " - + lineNumber +": "+ message +"\n"; - mConsoleMessages.append(consoleMessage); - Log.v(LOGTAG, "LOG: "+consoleMessage); + mConsoleMessages.append(msg); + Log.v(LOGTAG, "LOG: " + msg); + // the rationale here is that if there's an error of either type, and the test was + // waiting for "notifyDone" signal to finish, then there's no point in waiting + // anymore because the JS execution is already terminated at this point and a + // "notifyDone" will never come out so it's just wasting time till timeout kicks in + if (msg.contains("Uncaught ReferenceError:") || msg.contains("Uncaught TypeError:") + && mWaitUntilDone) { + Log.w(LOGTAG, "Terminating test case on uncaught ReferenceError or TypeError."); + mHandler.postDelayed(new Runnable() { + public void run() { + notifyDone(); + } + }, 500); + } + return true; } @Override |