add a paramter to control page-load-termination-on-JS-error
A previous change terminates page load if there's certain JS errors; the intention was to speed up layout tests such that page accessing non-existent test controllers/methods will get immediate termination instead of waiting on timeout. However this causes problem for page cycler because it may interrupt the test run too early. Also there was a bug on bracketing on the termination conditions (operator precendence issue). Change-Id: I2f19e48fa0061286fddf0f7cbb4953d7f7d88f76
This commit is contained in:
@@ -336,6 +336,7 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh
|
||||
intent.putExtra(TestShellActivity.TIMEOUT_IN_MILLIS, timeout);
|
||||
intent.putExtra(TestShellActivity.TOTAL_TEST_COUNT, mTestCount);
|
||||
intent.putExtra(TestShellActivity.CURRENT_TEST_NUMBER, testNumber);
|
||||
intent.putExtra(TestShellActivity.STOP_ON_REF_ERROR, true);
|
||||
activity.startActivity(intent);
|
||||
|
||||
// Wait until done.
|
||||
|
||||
@@ -179,6 +179,7 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
||||
mTimeoutInMillis = intent.getIntExtra(TIMEOUT_IN_MILLIS, 0);
|
||||
mGetDrawtime = intent.getBooleanExtra(GET_DRAW_TIME, false);
|
||||
mSaveImagePath = intent.getStringExtra(SAVE_IMAGE);
|
||||
mStopOnRefError = intent.getBooleanExtra(STOP_ON_REF_ERROR, false);
|
||||
setTitle("Test " + mCurrentTestNumber + " of " + mTotalTestCount);
|
||||
float ratio = (float)mCurrentTestNumber / mTotalTestCount;
|
||||
int progress = (int)(ratio * Window.PROGRESS_END);
|
||||
@@ -699,8 +700,8 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
||||
// 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) {
|
||||
if ((msg.contains("Uncaught ReferenceError:") || msg.contains("Uncaught TypeError:"))
|
||||
&& mWaitUntilDone && mStopOnRefError) {
|
||||
Log.w(LOGTAG, "Terminating test case on uncaught ReferenceError or TypeError.");
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
@@ -857,6 +858,7 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
||||
private boolean mGetDrawtime;
|
||||
private int mTotalTestCount;
|
||||
private int mCurrentTestNumber;
|
||||
private boolean mStopOnRefError;
|
||||
|
||||
// States
|
||||
private boolean mTimedOut;
|
||||
@@ -897,6 +899,7 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
||||
static final String SAVE_IMAGE = "SaveImage";
|
||||
static final String TOTAL_TEST_COUNT = "TestCount";
|
||||
static final String CURRENT_TEST_NUMBER = "TestNumber";
|
||||
static final String STOP_ON_REF_ERROR = "StopOnReferenceError";
|
||||
|
||||
static final int DRAW_RUNS = 5;
|
||||
static final String DRAW_TIME_LOG = "/sdcard/android/page_draw_time.txt";
|
||||
|
||||
Reference in New Issue
Block a user