Commit 6e1edd3e authored by Lan Wei's avatar Lan Wei Committed by Commit Bot

Simulate user inputs in mouseevent_move_button.html

Use testdriver Action API to simulate mouse actions in
uievents/mouse/mouseevent_move_button.html.

Bug: 1145677
Change-Id: Ie0924fe1086655c30ea765731a4927f9ec2191cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2516439
Commit-Queue: Lan Wei <lanwei@chromium.org>
Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824152}
parent aff43787
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<style> <style>
div.box { div.box {
border: 2px solid lightgray; border: 2px solid lightgray;
...@@ -41,6 +44,7 @@ ...@@ -41,6 +44,7 @@
<script> <script>
var test = async_test("mouse events fired without button state"); var test = async_test("mouse events fired without button state");
var button = -1; var button = -1;
var actions_promise;
function run() { function run() {
var lightgreen = document.getElementById("lightgreen"); var lightgreen = document.getElementById("lightgreen");
...@@ -77,9 +81,21 @@ ...@@ -77,9 +81,21 @@
on_event(lightblue, "mouseup", function (event) { on_event(lightblue, "mouseup", function (event) {
if (button != -1) { if (button != -1) {
test.step(function() {assert_equals(event.button, button, "Button must be the same as mousedown.");}); test.step(function() {assert_equals(event.button, button, "Button must be the same as mousedown.");});
test.done(); // Make sure the test finishes after all the input actions are completed.
actions_promise.then( () => {
test.done();
});
} }
}); });
// Inject mouse inputs.
var actions = new test_driver.Actions();
actions_promise = actions.pointerMove(0, 0, {origin: lightgreen})
.pointerDown({button: actions.ButtonType.MIDDLE})
.pointerMove(0, 0, {origin: lightyellow})
.pointerMove(0, 0, {origin: lightblue})
.pointerUp({button: actions.ButtonType.MIDDLE})
.send();
} }
</script> </script>
</body> </body>
......
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return mouseDragInTargets(['#lightgreen', '#lightyellow', '#lightblue'], /* middle button */ 1);
}
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