diff options
Diffstat (limited to 'tests/DumpRenderTree/src')
3 files changed, 28 insertions, 11 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java index ebdc9c7..57e06a1 100755 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java @@ -16,14 +16,11 @@ package com.android.dumprendertree; -import junit.framework.TestSuite; -import com.android.dumprendertree.LayoutTestsAutoTest; - +import android.os.Bundle; import android.test.InstrumentationTestRunner; import android.test.InstrumentationTestSuite; -import android.util.Log; -import android.content.Intent; -import android.os.Bundle; + +import junit.framework.TestSuite; /** @@ -61,6 +58,14 @@ public class LayoutTestsAutoRunner extends InstrumentationTestRunner { } } + String delay_str = (String) icicle.get("delay"); + if(delay_str != null) { + try { + this.mDelay = Integer.parseInt(delay_str); + } catch (Exception e) { + } + } + String r = (String)icicle.get("rebaseline"); this.mRebaseline = (r != null && r.toLowerCase().equals("true")); super.onCreate(icicle); @@ -68,6 +73,7 @@ public class LayoutTestsAutoRunner extends InstrumentationTestRunner { public String mTestPath = null; public int mTimeoutInMillis = 0; + public int mDelay = 0; public boolean mRebaseline = false; } diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTest.java index aa3940e..e63aa95 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTest.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTest.java @@ -25,7 +25,7 @@ public class ReliabilityTest extends ActivityInstrumentationTestCase2<Reliabilit static final String RELIABILITY_TEST_RUNNER_FILES[] = { "run_reliability_tests.py" }; - + public ReliabilityTest() { super(PKG_NAME, ReliabilityTestActivity.class); } @@ -51,6 +51,7 @@ public class ReliabilityTest extends ActivityInstrumentationTestCase2<Reliabilit Handler handler = null; boolean timeoutFlag = false; long start, elapsed; + //read from BufferedReader instead of populating a list in advance, //this will avoid excessive memory usage in case of a large list while((url = listReader.readLine()) != null) { @@ -63,7 +64,7 @@ public class ReliabilityTest extends ActivityInstrumentationTestCase2<Reliabilit handler = activity.getHandler(); handler.sendMessage(handler.obtainMessage( ReliabilityTestActivity.MSG_NAVIGATE, - runner.mTimeoutInMillis, 0, url)); + runner.mTimeoutInMillis, runner.mDelay, url)); timeoutFlag = activity.waitUntilDone(); elapsed = System.currentTimeMillis() - start; if(elapsed < 1000) { diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTestActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTestActivity.java index 75f1400..a374a41 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTestActivity.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTestActivity.java @@ -39,6 +39,8 @@ public class ReliabilityTestActivity extends Activity { private boolean pageDone; private Object pageDoneLock; private int pageStartCount; + private int manualDelay; + private PageDoneRunner pageDoneRunner = new PageDoneRunner(); @Override protected void onCreate(Bundle savedInstanceState) { @@ -73,6 +75,7 @@ public class ReliabilityTestActivity extends Activity { handleTimeout(); return; case MSG_NAVIGATE: + manualDelay = msg.arg2; navigate((String)msg.obj, msg.arg1); return; } @@ -246,11 +249,18 @@ public class ReliabilityTestActivity extends Activity { public void run() { if (initialStartCount == pageStartCount) { //perform cleanup - webView.stopLoading(); - Log.v(LOGTAG, "Finishing URL: " + webView.getUrl()); handler.removeMessages(MSG_TIMEOUT); - setPageDone(true); + webView.stopLoading(); + handler.postDelayed(pageDoneRunner, manualDelay); } } } + + class PageDoneRunner implements Runnable { + + public void run() { + Log.v(LOGTAG, "Finishing URL: " + webView.getUrl()); + setPageDone(true); + } + } } |
