diff options
author | Steve Block <steveblock@google.com> | 2010-02-25 12:50:33 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-26 17:19:51 +0000 |
commit | 12077e1179b4035ae2b1a44ccf9cd540e14b182e (patch) | |
tree | 29ce73bbc15c9c33c7c70db0f711da2e139858b1 /tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java | |
parent | 2ec30697c6cc6812dfaeb9a2e7d1da0443aeb8e6 (diff) |
Adds to DumpRenderTree the ability to look for Android-specific results
These Android-specific results will be added to
external/webkit/LayoutTests/platform/android-<js-engine> and are used in
preference to the generic expected results.
The JavaScript engine to use is read from the JS_ENGINE environment variable
used by the build system or can be overridden on the command line. If neither
is set, it defaults to JSC.
Change-Id: Ia8d107ced3968a5c061fd6f0f57451419bab6b27
Diffstat (limited to 'tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java')
-rw-r--r-- | tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java index 634d6831af3d..d9ec3fad3314 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java @@ -147,6 +147,9 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh private MyTestRecorder mResultRecorder; private Vector<String> mTestList; private boolean mRebaselineResults; + // The JavaScript engine currently in use. This determines which set of Android-specific + // expected test results we use. + private String mJsEngine; private String mTestPathPrefix; private boolean mFinished; @@ -214,14 +217,24 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh return shortName.replaceFirst(LAYOUT_TESTS_ROOT, LAYOUT_TESTS_RESULT_DIR) + "-result.txt"; } + // Gets the file which contains WebKit's expected results for this test. private String getExpectedResultFile(String test) { + // The generic result is at <path>/<name>-expected.txt + // First try the Android-specific result at + // platform/android-<js-engine>/<path>/<name>-expected.txt int pos = test.lastIndexOf('.'); - if(pos == -1) + if (pos == -1) return null; - String shortName = test.substring(0, pos); - return shortName + "-expected.txt"; + String genericExpectedResult = test.substring(0, pos) + "-expected.txt"; + String androidExpectedResultsDir = "platform/android-" + mJsEngine + "/"; + String androidExpectedResult = + genericExpectedResult.replaceFirst(LAYOUT_TESTS_ROOT, LAYOUT_TESTS_ROOT + androidExpectedResultsDir); + File f = new File(androidExpectedResult); + return f.exists() ? androidExpectedResult : genericExpectedResult; } + // Gets the file which contains the actual results of running the test on + // Android, generated by a previous run which set a new baseline. private String getAndroidExpectedResultFile(String expectedResultFile) { return expectedResultFile.replaceFirst(LAYOUT_TESTS_ROOT, ANDROID_EXPECTED_RESULT_DIR); } @@ -282,8 +295,8 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh }); String resultFile = getResultFile(test); - if(resultFile == null) { - //simply ignore this test + if (resultFile == null) { + // Simply ignore this test. return; } if (mRebaselineResults) { @@ -339,8 +352,10 @@ public class LayoutTestsAutoTest extends ActivityInstrumentationTestCase2<TestSh this.mTestList = new Vector<String>(); // Read settings - this.mTestPathPrefix = (new File(LAYOUT_TESTS_ROOT + runner.mTestPath)).getAbsolutePath(); - this.mRebaselineResults = runner.mRebaseline; + mTestPathPrefix = (new File(LAYOUT_TESTS_ROOT + runner.mTestPath)).getAbsolutePath(); + mRebaselineResults = runner.mRebaseline; + // JSC is the default JavaScript engine. + mJsEngine = runner.mJsEngine == null ? "jsc" : runner.mJsEngine; int timeout = runner.mTimeoutInMillis; if (timeout <= 0) { |