summaryrefslogtreecommitdiffstats
path: root/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java
diff options
context:
space:
mode:
authorSridhar Gurivireddy <>2009-03-31 10:57:18 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-31 10:57:18 -0700
commit41ac221de74793c0de5e253327d5d4c002229952 (patch)
tree3e951d37fcb6574f8a0099b07123384fb5602bad /tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java
parent08defa03546578b8c71a26668de8ff8feed727fd (diff)
downloadframeworks_base-41ac221de74793c0de5e253327d5d4c002229952.zip
frameworks_base-41ac221de74793c0de5e253327d5d4c002229952.tar.gz
frameworks_base-41ac221de74793c0de5e253327d5d4c002229952.tar.bz2
AI 143727: Make the test runner and results assets of DumpRendertree. This is done so that we could have
1) Lab machines can run layout tests without having build environment setup 2) We could have different set of pass/fail results per branch Also added a simple python script which runs run_layout_tests.py Automated import of CL 143727
Diffstat (limited to 'tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java')
-rw-r--r--tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java
index a857e68..39eae02 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java
@@ -42,6 +42,8 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.util.Vector;
//TestRecorder creates two files, one for passing tests
@@ -122,6 +124,18 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh
static final String ANDROID_EXPECTED_RESULT_DIR = "/sdcard/android/expected_results/";
static final String LAYOUT_TESTS_LIST_FILE = "/sdcard/android/layout_tests_list.txt";
static final String TEST_STATUS_FILE = "/sdcard/android/running_test.txt";
+ static final String LAYOUT_TESTS_RESULTS_REFERENCE_FILES[] = {
+ "results/layout_tests_passed.txt",
+ "results/layout_tests_failed.txt",
+ "results/layout_tests_nontext.txt",
+ "results/layout_tests_crashed.txt",
+ "run_layout_tests.py"
+ };
+
+ static final String LAYOUT_RESULTS_FAILED_RESULT_FILE = "results/layout_tests_failed.txt";
+ static final String LAYOUT_RESULTS_NONTEXT_RESULT_FILE = "results/layout_tests_nontext.txt";
+ static final String LAYOUT_RESULTS_CRASHED_RESULT_FILE = "results/layout_tests_crashed.txt";
+ static final String LAYOUT_TESTS_RUNNER = "run_layout_tests.py";
private MyTestRecorder mResultRecorder;
private Vector<String> mTestList;
@@ -452,4 +466,28 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh
public void resumeLayoutTests() {
executeLayoutTests(true);
}
+
+ public void copyResultsAndRunnerAssetsToCache() {
+ try {
+ String out_dir = getActivity().getApplicationContext().getCacheDir().getPath() + "/";
+
+ for( int i=0; i< LAYOUT_TESTS_RESULTS_REFERENCE_FILES.length; i++) {
+ InputStream in = getActivity().getAssets().open(LAYOUT_TESTS_RESULTS_REFERENCE_FILES[i]);
+ OutputStream out = new FileOutputStream(out_dir + LAYOUT_TESTS_RESULTS_REFERENCE_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();
+ }
+
+ }
+
}