Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/external/wpt_automation/input-events/inputevent_common_input.js |
| diff --git a/third_party/WebKit/LayoutTests/external/wpt_automation/input-events/inputevent_common_input.js b/third_party/WebKit/LayoutTests/external/wpt_automation/input-events/inputevent_common_input.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..494a1060f23c348b8a349b4710262d64f47d91e7 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/external/wpt_automation/input-events/inputevent_common_input.js |
| @@ -0,0 +1,25 @@ |
| +function keyDown(key, modifiers) { |
| + return new Promise(function(resolve, reject) { |
| + if (window.eventSender) { |
| + eventSender.keyDown(key, modifiers); |
| + resolve(); |
| + } else { |
| + reject(); |
| + } |
| + }); |
| +} |
| + |
| +function focus(selector) { |
| + return new Promise(function(resolve, reject) { |
| + document.querySelector(selector).focus(); |
|
foolip
2017/06/01 13:54:21
Can you add a comment about why both this and keyD
chongz
2017/06/01 15:34:13
Yes I was thinking if we are going to use WebDrive
|
| + resolve(); |
| + }); |
| +} |
| + |
| +{ |
| + const inputevent_automation = async_test("InputEvent Automation"); |
| + // Defined in every test and should return a promise that gets resolved when input is finished. |
| + inject_input().then(function() { |
| + inputevent_automation.done(); |
|
foolip
2017/06/01 13:54:21
optional nit: could make this inject_input().then(
chongz
2017/06/01 15:34:13
Done.
|
| + }); |
| +} |