summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/DumpRenderTree/assets/run_page_cycler.py (renamed from tests/DumpRenderTree/run_page_cycler.py)2
-rw-r--r--tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java2
-rw-r--r--tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java34
3 files changed, 35 insertions, 3 deletions
diff --git a/tests/DumpRenderTree/run_page_cycler.py b/tests/DumpRenderTree/assets/run_page_cycler.py
index 7f728a38245a..2325047a1840 100755
--- a/tests/DumpRenderTree/run_page_cycler.py
+++ b/tests/DumpRenderTree/assets/run_page_cycler.py
@@ -56,7 +56,7 @@ def main(options, args):
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 \
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java
index 910cb8dedcd7..562b1f32aaca 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java
@@ -470,7 +470,7 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh
byte[] buf = new byte[2048];
int len;
- while ((len = in.read(buf)) > 0 ) {
+ while ((len = in.read(buf)) >= 0 ) {
out.write(buf, 0, len);
}
out.close();
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
index e793ed4d3f99..5cb51554abfc 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
@@ -31,6 +31,8 @@ import com.android.dumprendertree.TestShellCallback;
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> {
@@ -38,6 +40,9 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShel
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);
@@ -54,7 +59,7 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShel
// 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) {
@@ -149,4 +154,31 @@ public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShel
}
}
}
+
+ 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();
+ }
+
+ }
+
}