Added new parameter to enable a manual pause between pages
This commit is contained in:
@@ -75,6 +75,11 @@ def main(options, args):
|
|||||||
else:
|
else:
|
||||||
timedout_file = options.timeout_file
|
timedout_file = options.timeout_file
|
||||||
|
|
||||||
|
if not options.delay:
|
||||||
|
manual_delay = 0
|
||||||
|
else:
|
||||||
|
manual_delay = options.delay
|
||||||
|
|
||||||
adb_cmd = "adb "
|
adb_cmd = "adb "
|
||||||
if options.adb_options:
|
if options.adb_options:
|
||||||
adb_cmd += options.adb_options + " "
|
adb_cmd += options.adb_options + " "
|
||||||
@@ -110,8 +115,8 @@ def main(options, args):
|
|||||||
# Call ReliabilityTestsAutoTest#startReliabilityTests
|
# Call ReliabilityTestsAutoTest#startReliabilityTests
|
||||||
test_cmd = (test_cmd_prefix + " -e class "
|
test_cmd = (test_cmd_prefix + " -e class "
|
||||||
"com.android.dumprendertree.ReliabilityTest#"
|
"com.android.dumprendertree.ReliabilityTest#"
|
||||||
"runReliabilityTest -e timeout %s %s" %
|
"runReliabilityTest -e timeout %s -e delay %s %s" %
|
||||||
(str(timeout_ms), test_cmd_postfix))
|
(str(timeout_ms), str(manual_delay), test_cmd_postfix))
|
||||||
|
|
||||||
adb_output = subprocess.Popen(test_cmd, shell=True,
|
adb_output = subprocess.Popen(test_cmd, shell=True,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
@@ -153,20 +158,23 @@ def main(options, args):
|
|||||||
|
|
||||||
if "__main__" == __name__:
|
if "__main__" == __name__:
|
||||||
option_parser = optparse.OptionParser()
|
option_parser = optparse.OptionParser()
|
||||||
option_parser.add_option("", "--time-out-ms",
|
option_parser.add_option("-t", "--time-out-ms",
|
||||||
default=60000,
|
default=60000,
|
||||||
help="set the timeout for each test")
|
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,
|
default=False,
|
||||||
help="include debug-level logging")
|
help="include debug-level logging")
|
||||||
option_parser.add_option("", "--adb-options",
|
option_parser.add_option("-a", "--adb-options",
|
||||||
default=None,
|
default=None,
|
||||||
help="pass options to adb, such as -d -e, etc")
|
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",
|
default="reliability_crashed_sites.txt",
|
||||||
help="the list of sites that cause browser to crash")
|
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",
|
default="reliability_timedout_sites.txt",
|
||||||
help="the list of sites that timedout during test.")
|
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()
|
opts, arguments = option_parser.parse_args()
|
||||||
main(opts, arguments)
|
main(opts, arguments)
|
||||||
|
|||||||
@@ -16,14 +16,11 @@
|
|||||||
|
|
||||||
package com.android.dumprendertree;
|
package com.android.dumprendertree;
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
import android.os.Bundle;
|
||||||
import com.android.dumprendertree.LayoutTestsAutoTest;
|
|
||||||
|
|
||||||
import android.test.InstrumentationTestRunner;
|
import android.test.InstrumentationTestRunner;
|
||||||
import android.test.InstrumentationTestSuite;
|
import android.test.InstrumentationTestSuite;
|
||||||
import android.util.Log;
|
|
||||||
import android.content.Intent;
|
import junit.framework.TestSuite;
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -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");
|
String r = (String)icicle.get("rebaseline");
|
||||||
this.mRebaseline = (r != null && r.toLowerCase().equals("true"));
|
this.mRebaseline = (r != null && r.toLowerCase().equals("true"));
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
@@ -68,6 +73,7 @@ public class LayoutTestsAutoRunner extends InstrumentationTestRunner {
|
|||||||
|
|
||||||
public String mTestPath = null;
|
public String mTestPath = null;
|
||||||
public int mTimeoutInMillis = 0;
|
public int mTimeoutInMillis = 0;
|
||||||
|
public int mDelay = 0;
|
||||||
public boolean mRebaseline = false;
|
public boolean mRebaseline = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public class ReliabilityTest extends ActivityInstrumentationTestCase2<Reliabilit
|
|||||||
Handler handler = null;
|
Handler handler = null;
|
||||||
boolean timeoutFlag = false;
|
boolean timeoutFlag = false;
|
||||||
long start, elapsed;
|
long start, elapsed;
|
||||||
|
|
||||||
//read from BufferedReader instead of populating a list in advance,
|
//read from BufferedReader instead of populating a list in advance,
|
||||||
//this will avoid excessive memory usage in case of a large list
|
//this will avoid excessive memory usage in case of a large list
|
||||||
while((url = listReader.readLine()) != null) {
|
while((url = listReader.readLine()) != null) {
|
||||||
@@ -63,7 +64,7 @@ public class ReliabilityTest extends ActivityInstrumentationTestCase2<Reliabilit
|
|||||||
handler = activity.getHandler();
|
handler = activity.getHandler();
|
||||||
handler.sendMessage(handler.obtainMessage(
|
handler.sendMessage(handler.obtainMessage(
|
||||||
ReliabilityTestActivity.MSG_NAVIGATE,
|
ReliabilityTestActivity.MSG_NAVIGATE,
|
||||||
runner.mTimeoutInMillis, 0, url));
|
runner.mTimeoutInMillis, runner.mDelay, url));
|
||||||
timeoutFlag = activity.waitUntilDone();
|
timeoutFlag = activity.waitUntilDone();
|
||||||
elapsed = System.currentTimeMillis() - start;
|
elapsed = System.currentTimeMillis() - start;
|
||||||
if(elapsed < 1000) {
|
if(elapsed < 1000) {
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ public class ReliabilityTestActivity extends Activity {
|
|||||||
private boolean pageDone;
|
private boolean pageDone;
|
||||||
private Object pageDoneLock;
|
private Object pageDoneLock;
|
||||||
private int pageStartCount;
|
private int pageStartCount;
|
||||||
|
private int manualDelay;
|
||||||
|
private PageDoneRunner pageDoneRunner = new PageDoneRunner();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -73,6 +75,7 @@ public class ReliabilityTestActivity extends Activity {
|
|||||||
handleTimeout();
|
handleTimeout();
|
||||||
return;
|
return;
|
||||||
case MSG_NAVIGATE:
|
case MSG_NAVIGATE:
|
||||||
|
manualDelay = msg.arg2;
|
||||||
navigate((String)msg.obj, msg.arg1);
|
navigate((String)msg.obj, msg.arg1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -246,11 +249,18 @@ public class ReliabilityTestActivity extends Activity {
|
|||||||
public void run() {
|
public void run() {
|
||||||
if (initialStartCount == pageStartCount) {
|
if (initialStartCount == pageStartCount) {
|
||||||
//perform cleanup
|
//perform cleanup
|
||||||
webView.stopLoading();
|
|
||||||
Log.v(LOGTAG, "Finishing URL: " + webView.getUrl());
|
|
||||||
handler.removeMessages(MSG_TIMEOUT);
|
handler.removeMessages(MSG_TIMEOUT);
|
||||||
|
webView.stopLoading();
|
||||||
|
handler.postDelayed(pageDoneRunner, manualDelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PageDoneRunner implements Runnable {
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
Log.v(LOGTAG, "Finishing URL: " + webView.getUrl());
|
||||||
setPageDone(true);
|
setPageDone(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user