am f8c90acd: Merge change 25319 into eclair

Merge commit 'f8c90acd7fde806d2d9cccf4d6ec52dc279497bc' into eclair-plus-aosp

* commit 'f8c90acd7fde806d2d9cccf4d6ec52dc279497bc':
  Only move to the next test in DRT after the test has completed AND the page has finished loading.
This commit is contained in:
Ben Murdoch
2009-09-17 08:47:53 -07:00
committed by Android Git Automerger

View File

@@ -291,13 +291,20 @@ public class TestShellActivity extends Activity implements LayoutTestController
} }
public void finished() { public void finished() {
if (mUiAutoTestPath != null) { if (mTestPageLoaded) {
//don't really finish here if (mUiAutoTestPath != null) {
moveToNextTest(); //don't really finish here
} else { moveToNextTest();
if (mCallback != null) { } else {
mCallback.finished(); if (mCallback != null) {
mCallback.finished();
}
} }
} else {
// The test is complete but the page has not completed loading. We
// can't continue to the next test until both the test is finished
// and the page has stopped loading.
mReadyForNextTest = true;
} }
} }
@@ -445,12 +452,14 @@ public class TestShellActivity extends Activity implements LayoutTestController
@Override @Override
public void onPageFinished(WebView view, String url) { public void onPageFinished(WebView view, String url) {
Log.v(LOGTAG, "onPageFinished, url=" + url); Log.v(LOGTAG, "onPageFinished, url=" + url);
mTestPageLoaded = true;
super.onPageFinished(view, url); super.onPageFinished(view, url);
} }
@Override @Override
public void onPageStarted(WebView view, String url, Bitmap favicon) { public void onPageStarted(WebView view, String url, Bitmap favicon) {
Log.v(LOGTAG, "onPageStarted, url=" + url); Log.v(LOGTAG, "onPageStarted, url=" + url);
mTestPageLoaded = false;
super.onPageStarted(view, url, favicon); super.onPageStarted(view, url, favicon);
} }
@@ -480,6 +489,17 @@ public class TestShellActivity extends Activity implements LayoutTestController
@Override @Override
public void onProgressChanged(WebView view, int newProgress) { public void onProgressChanged(WebView view, int newProgress) {
if (newProgress == 100) { if (newProgress == 100) {
if (mReadyForNextTest) {
// In this case, the test has completed (i.e. called
// layoutTestController.notifyDone) before the page finished loading. This
// usually happens if the test is not invoked by an onload handler, rather
// directly in a script tag. Now that the page has finished loading, it is
// safe for DRT to go to the next test.
finished();
return;
}
if (!mTimedOut && !mWaitUntilDone && !mRequestedWebKitData) { if (!mTimedOut && !mWaitUntilDone && !mRequestedWebKitData) {
String url = mWebView.getUrl(); String url = mWebView.getUrl();
Log.v(LOGTAG, "Finished: "+ url); Log.v(LOGTAG, "Finished: "+ url);
@@ -655,6 +675,8 @@ public class TestShellActivity extends Activity implements LayoutTestController
mDumpDatabaseCallbacks = false; mDumpDatabaseCallbacks = false;
mCanOpenWindows = false; mCanOpenWindows = false;
mEventSender.resetMouse(); mEventSender.resetMouse();
mTestPageLoaded = false;
mReadyForNextTest = false;
} }
private void setupWebViewForLayoutTests(WebView webview, CallbackProxy callbackProxy) { private void setupWebViewForLayoutTests(WebView webview, CallbackProxy callbackProxy) {
@@ -711,6 +733,9 @@ public class TestShellActivity extends Activity implements LayoutTestController
private StringBuffer mConsoleMessages; private StringBuffer mConsoleMessages;
private boolean mCanOpenWindows; private boolean mCanOpenWindows;
private boolean mTestPageLoaded = false;
private boolean mReadyForNextTest = false;
static final String TIMEOUT_STR = "**Test timeout"; static final String TIMEOUT_STR = "**Test timeout";
static final int MSG_TIMEOUT = 0; static final int MSG_TIMEOUT = 0;