Commit f3d2f1bd authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Add partial implementation of test_driver.send_keys().

Now it supports single character strings, U+E004, and U+E050.
The following tests are workable.

- focus-01.html and inert-node-is-uneditable.tentative.html:
  Send a single ASCII character
- focus-tabindex-*.html: Send U+E004
- focus-visible-007.html: Sends U+E050

Bug: 828858
Change-Id: I17d20c21e3f34eca609c1f027784f200de2addae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1652635Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#669569}
parent 755ff2f0
...@@ -784,12 +784,7 @@ external/wpt/css/css-writing-modes/first-page-vlr-003.xht [ WontFix ] ...@@ -784,12 +784,7 @@ external/wpt/css/css-writing-modes/first-page-vlr-003.xht [ WontFix ]
external/wpt/css/css-writing-modes/first-page-vrl-002.xht [ WontFix ] external/wpt/css/css-writing-modes/first-page-vrl-002.xht [ WontFix ]
external/wpt/css/css-writing-modes/page-flow-direction-002.xht [ WontFix ] external/wpt/css/css-writing-modes/page-flow-direction-002.xht [ WontFix ]
external/wpt/css/css-writing-modes/page-flow-direction-003.xht [ WontFix ] external/wpt/css/css-writing-modes/page-flow-direction-003.xht [ WontFix ]
external/wpt/html/interaction/focus/focus-01.html [ WontFix ]
external/wpt/html/interaction/focus/focus-02.html [ WontFix ] external/wpt/html/interaction/focus/focus-02.html [ WontFix ]
external/wpt/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-negative.html [ WontFix ]
external/wpt/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-order.html [ WontFix ]
external/wpt/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-positive.html [ WontFix ]
external/wpt/html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/focus-tabindex-zero.html [ WontFix ]
virtual/layout_ng/external/wpt/css/CSS2/linebox/inline-formatting-context-010b.xht [ WontFix ] virtual/layout_ng/external/wpt/css/CSS2/linebox/inline-formatting-context-010b.xht [ WontFix ]
virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-replaced-height-008.xht [ WontFix ] virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-replaced-height-008.xht [ WontFix ]
virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-height-008.xht [ WontFix ] virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-height-008.xht [ WontFix ]
......
...@@ -5444,10 +5444,6 @@ crbug.com/615885 external/wpt/content-security-policy/securitypolicyviolation/im ...@@ -5444,10 +5444,6 @@ crbug.com/615885 external/wpt/content-security-policy/securitypolicyviolation/im
crbug.com/849975 external/wpt/css/css-animations/Element-getAnimations.tentative.html [ Pass Failure ] crbug.com/849975 external/wpt/css/css-animations/Element-getAnimations.tentative.html [ Pass Failure ]
crbug.com/849975 virtual/threaded/external/wpt/css/css-animations/Element-getAnimations.tentative.html [ Pass Failure ] crbug.com/849975 virtual/threaded/external/wpt/css/css-animations/Element-getAnimations.tentative.html [ Pass Failure ]
# These won't pass as layout tests until the linked bug is fixed.
crbug.com/828858 external/wpt/css/selectors/focus-visible-007.html [ Failure ]
crbug.com/828858 external/wpt/inert/inert-node-is-uneditable.tentative.html [ Failure ]
# Sheriff 2018-06-07 # Sheriff 2018-06-07
crbug.com/850358 http/tests/devtools/editor/text-editor-enter-behaviour.js [ Pass Failure Timeout ] crbug.com/850358 http/tests/devtools/editor/text-editor-enter-behaviour.js [ Pass Failure Timeout ]
crbug.com/849978 http/tests/devtools/elements/styles-4/stylesheet-source-url-comment.js [ Pass Failure Timeout ] crbug.com/849978 http/tests/devtools/elements/styles-4/stylesheet-source-url-comment.js [ Pass Failure Timeout ]
......
This is a testharness.js-based test.
FAIL Using keyboard while element is focused should trigger :focus-visible; using mouse without moving focus should not cancel it; moving focus using mouse should cancel it. assert_equals: expected "rgb(59, 153, 252)" but got "rgb(0, 100, 0)"
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL Can't edit inert contenteditable assert_true: send_keys not implemented yet expected true got false
FAIL Can edit non-inert contenteditable assert_true: send_keys not implemented yet expected true got false
Harness: the test ran to completion.
...@@ -63,6 +63,32 @@ ...@@ -63,6 +63,32 @@
}); });
}; };
// https://w3c.github.io/webdriver/#element-send-keys
window.test_driver_internal.send_keys = function(element, keys) {
return new Promise((resolve, reject) => {
element.focus();
if (!window.eventSender)
reject(new Error("No eventSender"));
if (keys.length > 1)
reject(new Error("No support for a sequence of multiple keys"));
let eventSenderKeys = keys;
let charCode = keys.charCodeAt(0);
// See https://w3c.github.io/webdriver/#keyboard-actions and
// EventSender::KeyDown().
if (charCode == 0xE004) {
eventSenderKeys = "Tab";
} else if (charCode == 0xE050) {
eventSenderKeys = "ShiftRight";
} else if (charCode >= 0xE000 && charCode <= 0xF8FF) {
reject(new Error("No support for this code: U+" + charCode.toString(16)));
}
window.requestAnimationFrame(() => {
window.eventSender.keyDown(eventSenderKeys);
resolve();
});
});
};
window.test_driver_internal.freeze = function() { window.test_driver_internal.freeze = function() {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
if (window.chrome && chrome.gpuBenchmarking) { if (window.chrome && chrome.gpuBenchmarking) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment