summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGuang Zhu <guangzhu@google.com>2009-06-03 12:23:09 -0700
committerGuang Zhu <guangzhu@google.com>2009-06-03 12:23:09 -0700
commit3e8950c0c73f9c1574ce3388c754009edf6bc930 (patch)
tree6c96605e1dfa8d1c0c87479070bc3f1ebe06d390 /tests
parentbe512bff60626efc9a4b85d271d6210b9115e5fc (diff)
downloadframeworks_base-3e8950c0c73f9c1574ce3388c754009edf6bc930.zip
frameworks_base-3e8950c0c73f9c1574ce3388c754009edf6bc930.tar.gz
frameworks_base-3e8950c0c73f9c1574ce3388c754009edf6bc930.tar.bz2
Added new parameter to enable a manual pause between pages
Diffstat (limited to 'tests')
-rwxr-xr-xtests/DumpRenderTree/assets/run_reliability_tests.py22
-rwxr-xr-xtests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java18
-rw-r--r--tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTest.java5
-rw-r--r--tests/DumpRenderTree/src/com/android/dumprendertree/ReliabilityTestActivity.java16
4 files changed, 43 insertions, 18 deletions
diff --git a/tests/DumpRenderTree/assets/run_reliability_tests.py b/tests/DumpRenderTree/assets/run_reliability_tests.py
index 84b9501..6aab009 100755
--- a/tests/DumpRenderTree/assets/run_reliability_tests.py
+++ b/tests/DumpRenderTree/assets/run_reliability_tests.py
@@ -75,6 +75,11 @@ def main(options, args):
else:
timedout_file = options.timeout_file
+ if not options.delay:
+ manual_delay = 0
+ else:
+ manual_delay = options.delay
+
adb_cmd = "adb "
if options.adb_options:
adb_cmd += options.adb_options + " "
@@ -110,8 +115,8 @@ def main(options, args):
# Call ReliabilityTestsAutoTest#startReliabilityTests
test_cmd = (test_cmd_prefix + " -e class "
"com.android.dumprendertree.ReliabilityTest#"
- "runReliabilityTest -e timeout %s %s" %
- (str(timeout_ms), test_cmd_postfix))
+ "runReliabilityTest -e timeout %s -e delay %s %s" %
+ (str(timeout_ms), str(manual_delay), test_cmd_postfix))
adb_output = subprocess.Popen(test_cmd, shell=True,
stdout=subprocess.PIPE,
@@ -153,20 +158,23 @@ def main(options, args):
if "__main__" == __name__:
option_parser = optparse.OptionParser()
- option_parser.add_option("", "--time-out-ms",
+ option_parser.add_option("-t", "--time-out-ms",
default=60000,
help="set the timeout for each test")
- option_parser.add_option("", "--verbose", action="store_true",
+ option_parser.add_option("-v", "--verbose", action="store_true",
default=False,
help="include debug-level logging")
- option_parser.add_option("", "--adb-options",
+ option_parser.add_option("-a", "--adb-options",
default=None,
help="pass options to adb, such as -d -e, etc")
- option_parser.add_option("", "--crash-file",
+ option_parser.add_option("-c", "--crash-file",
default="reliability_crashed_sites.txt",
help="the list of sites that cause browser to crash")
- option_parser.add_option("", "--timeout-file",
+ option_parser.add_option("-f", "--timeout-file",
default="reliability_timedout_sites.txt",
help="the list of sites that timedout during test.")
+ option_parser.add_option("-d", "--delay",
+ default=0,
+ help="add a manual delay between pages (in ms)")
opts, arguments = option_parser.parse_args()
main(opts, arguments)
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);
+ }
+ }
}