run_load_test_cmd_postfix = " -w com.android.dumprendertree/.LayoutTestsAutoRunner"
# Call LoadTestsAutoTest::runTest.
- run_load_test_cmd = run_load_test_cmd_prefix + " -e class com.android.dumprendertree.LoadTestsAutoTest#runTest -e path \"" + path + "\" -e timeout " + timeout_ms + run_load_test_cmd_postfix
+ run_load_test_cmd = run_load_test_cmd_prefix + " -e class com.android.dumprendertree.LoadTestsAutoTest#runPageCyclerTest -e path \"" + path + "\" -e timeout " + timeout_ms + run_load_test_cmd_postfix
(adb_output, adb_error) = subprocess.Popen(run_load_test_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
if adb_output.find('INSTRUMENTATION_FAILED') != -1 or \
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.io.PrintStream;
public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShellActivity> {
private final static String LOGTAG = "LoadTest";
private final static String LOAD_TEST_RESULT = "/sdcard/load_test_result.txt";
private boolean mFinished;
+ static final String LOAD_TEST_RUNNER_FILES[] = {
+ "run_page_cycler.py"
+ };
public LoadTestsAutoTest() {
super("com.android.dumprendertree", TestShellActivity.class);
// Invokes running of layout tests
// and waits till it has finished running.
- public void runTest() {
+ public void runPageCyclerTest() {
LayoutTestsAutoRunner runner = (LayoutTestsAutoRunner) getInstrumentation();
if (runner.mTestPath == null) {
}
}
}
+
+ public void copyRunnerAssetsToCache() {
+ try {
+ String out_dir = getActivity().getApplicationContext()
+ .getCacheDir().getPath() + "/";
+
+ for( int i=0; i< LOAD_TEST_RUNNER_FILES.length; i++) {
+ InputStream in = getActivity().getAssets().open(
+ LOAD_TEST_RUNNER_FILES[i]);
+ OutputStream out = new FileOutputStream(
+ out_dir + LOAD_TEST_RUNNER_FILES[i]);
+
+ byte[] buf = new byte[2048];
+ int len;
+
+ while ((len = in.read(buf)) >= 0 ) {
+ out.write(buf, 0, len);
+ }
+ out.close();
+ in.close();
+ }
+ }catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
}