summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/text/TextUtils.java6
-rw-r--r--core/java/android/webkit/WebTextView.java19
-rw-r--r--core/java/android/webkit/WebView.java2
-rwxr-xr-xtests/DumpRenderTree/assets/run_layout_tests.py14
-rw-r--r--tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java1
-rwxr-xr-xtests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java17
-rw-r--r--tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoTest.java29
7 files changed, 62 insertions, 26 deletions
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java
index afb22acef433..9589bf369e6e 100644
--- a/core/java/android/text/TextUtils.java
+++ b/core/java/android/text/TextUtils.java
@@ -1557,13 +1557,17 @@ public class TextUtils {
* @param reqModes The modes to be checked: may be any combination of
* {@link #CAP_MODE_CHARACTERS}, {@link #CAP_MODE_WORDS}, and
* {@link #CAP_MODE_SENTENCES}.
- *
+ *
* @return Returns the actual capitalization modes that can be in effect
* at the current position, which is any combination of
* {@link #CAP_MODE_CHARACTERS}, {@link #CAP_MODE_WORDS}, and
* {@link #CAP_MODE_SENTENCES}.
*/
public static int getCapsMode(CharSequence cs, int off, int reqModes) {
+ if (off < 0) {
+ return 0;
+ }
+
int i;
char c;
int mode = 0;
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index d1ad61fa9bdc..db19bcacc19c 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -304,15 +304,16 @@ import java.util.ArrayList;
public void onEditorAction(int actionCode) {
switch (actionCode) {
case EditorInfo.IME_ACTION_NEXT:
- // Since the cursor will no longer be in the same place as the
- // focus, set the focus controller back to inactive
- mWebView.setFocusControllerInactive();
- mWebView.nativeMoveCursorToNextTextInput();
- // Preemptively rebuild the WebTextView, so that the action will
- // be set properly.
- mWebView.rebuildWebTextView();
- setDefaultSelection();
- mWebView.invalidate();
+ if (mWebView.nativeMoveCursorToNextTextInput()) {
+ // Since the cursor will no longer be in the same place as the
+ // focus, set the focus controller back to inactive
+ mWebView.setFocusControllerInactive();
+ // Preemptively rebuild the WebTextView, so that the action will
+ // be set properly.
+ mWebView.rebuildWebTextView();
+ setDefaultSelection();
+ mWebView.invalidate();
+ }
break;
case EditorInfo.IME_ACTION_DONE:
super.onEditorAction(actionCode);
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index d29d6f378274..897bd75fe1aa 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -6807,7 +6807,7 @@ public class WebView extends AbsoluteLayout
private native void nativeHideCursor();
private native String nativeImageURI(int x, int y);
private native void nativeInstrumentReport();
- /* package */ native void nativeMoveCursorToNextTextInput();
+ /* package */ native boolean nativeMoveCursorToNextTextInput();
// return true if the page has been scrolled
private native boolean nativeMotionUp(int x, int y, int slop);
// returns false if it handled the key
diff --git a/tests/DumpRenderTree/assets/run_layout_tests.py b/tests/DumpRenderTree/assets/run_layout_tests.py
index c3627bbf8fae..7f3ef2d07c88 100755
--- a/tests/DumpRenderTree/assets/run_layout_tests.py
+++ b/tests/DumpRenderTree/assets/run_layout_tests.py
@@ -26,6 +26,7 @@
--time-out-ms (default is 8000 millis) for each test
--adb-options="-e" passes option string to adb
--results-directory=..., (default is ./layout-test-results) directory name under which results are stored.
+ --js-engine the JavaScript engine currently in use, determines which set of Android-specific expected results we should use, should be 'jsc' or 'v8'
"""
import logging
@@ -186,6 +187,16 @@ def main(options, args):
run_layout_test_cmd_postfix = " -e path \"" + path + "\" -e timeout " + timeout_ms
if options.rebaseline:
run_layout_test_cmd_postfix += " -e rebaseline true"
+
+ # If the JS engine is not specified on the command line, try reading the
+ # JS_ENGINE environment variable, which is used by the build system in
+ # external/webkit/Android.mk.
+ js_engine = options.js_engine
+ if not js_engine:
+ js_engine = os.environ['JS_ENGINE']
+ if js_engine:
+ run_layout_test_cmd_postfix += " -e jsengine " + js_engine
+
run_layout_test_cmd_postfix += " -w com.android.dumprendertree/.LayoutTestsAutoRunner"
# Call LayoutTestsAutoTest::startLayoutTests.
@@ -297,6 +308,9 @@ if '__main__' == __name__:
default=None,
dest="ref_directory",
help="directory where reference results are stored.")
+ option_parser.add_option("", "--js-engine",
+ default=None,
+ help="The JavaScript engine currently in use, which determines which set of Android-specific expected results we should use. Should be 'jsc' or 'v8'.");
options, args = option_parser.parse_args();
main(options, args)
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java b/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java
index 6ceb0f927070..191b5e94ae73 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/FileFilter.java
@@ -84,7 +84,6 @@ public class FileFilter {
// This first block of tests are for HTML5 features, for which Android
// should pass all tests. They are skipped only temporarily.
// TODO: Fix these failing tests and remove them from this list.
- ignoreResultList.add("fast/dom/Geolocation/callback-exception.html"); // exception output incorrect with V8
ignoreResultList.add("http/tests/appcache/auth.html"); // file not found
ignoreResultList.add("http/tests/appcache/deferred-events.html"); // file not found
ignoreResultList.add("http/tests/appcache/deferred-events-delete-while-raising.html"); // file not found
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java
index 539d55105b23..e058f3221080 100755
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LayoutTestsAutoRunner.java
@@ -79,14 +79,17 @@ public class LayoutTestsAutoRunner extends InstrumentationTestRunner {
mSaveImagePath = (String) icicle.get("saveimage");
+ mJsEngine = (String) icicle.get("jsengine");
+
super.onCreate(icicle);
}
- public String mTestPath = null;
- public String mSaveImagePath = null;
- public int mTimeoutInMillis = 0;
- public int mDelay = 0;
- public boolean mRebaseline = false;
- public boolean mLogtime = false;
- public boolean mGetDrawTime = false;
+ public String mTestPath;
+ public String mSaveImagePath;
+ public int mTimeoutInMillis;
+ public int mDelay;
+ public boolean mRebaseline;
+ public boolean mLogtime;
+ public boolean mGetDrawTime;
+ public String mJsEngine;
}
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) {