Added new parameter to enable a manual pause between pages
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user