Commit 94e8c4cb authored by Lan Wei's avatar Lan Wei Committed by Chromium LUCI CQ

Simulate user inputs in pointerevent_capture_suppressing_mouse.html

Use testdriver Action API to simulate mouse actions in
pointerevents/pointerevent_capture_suppressing_mouse.html.

Bug: 1145677
Change-Id: I329d4b814020dd3c0d22c807c36828f5e868b4cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2568825Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Commit-Queue: Lan Wei <lanwei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833510}
parent 4c78f991
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
<link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> <link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
<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>
<!-- Additional helper script for common checks across event types --> <!-- Additional helper script for common checks across event types -->
<script type="text/javascript" src="pointerevent_support.js"></script> <script type="text/javascript" src="pointerevent_support.js"></script>
</head> </head>
...@@ -53,6 +56,7 @@ ...@@ -53,6 +56,7 @@
var test_lostpointercapture = async_test("lostpointercapture event received"); var test_lostpointercapture = async_test("lostpointercapture event received");
var test_pointerover_no_capture = async_test("pointerover event without capture received"); var test_pointerover_no_capture = async_test("pointerover event without capture received");
var test_pointerover_capture = async_test("pointerover event with capture received"); var test_pointerover_capture = async_test("pointerover event with capture received");
var test_pointerout_no_capture = async_test("pointerout event without capture received"); var test_pointerout_no_capture = async_test("pointerout event without capture received");
...@@ -64,6 +68,8 @@ ...@@ -64,6 +68,8 @@
var test_pointerleave_no_capture = async_test("pointerleave event without capture received"); var test_pointerleave_no_capture = async_test("pointerleave event without capture received");
var test_pointerleave_after_capture = async_test("pointerleave event after lostpointercapture received"); var test_pointerleave_after_capture = async_test("pointerleave event after lostpointercapture received");
var actions_promise;
window.onload = function() { window.onload = function() {
on_event(captureButton, 'pointerdown', function(e) { on_event(captureButton, 'pointerdown', function(e) {
if(isPointerCapture == false) { if(isPointerCapture == false) {
...@@ -147,7 +153,10 @@ ...@@ -147,7 +153,10 @@
} }
else { else {
if (lostPointerCaptureReceived) { if (lostPointerCaptureReceived) {
test_pointerleave_after_capture.done(); // Make sure the test finishes after all the input actions are completed.
actions_promise.then( () => {
test_pointerleave_after_capture.done();
});
} else { } else {
test_pointerleave_no_capture.done(); test_pointerleave_no_capture.done();
} }
...@@ -190,6 +199,20 @@ ...@@ -190,6 +199,20 @@
}, "pointerleave shouldn't trigger for the purple rectangle while the black rectangle has capture"); }, "pointerleave shouldn't trigger for the purple rectangle while the black rectangle has capture");
} }
}); });
actions_promise = new test_driver.Actions()
.pointerMove(0, 0, {origin: target0})
.pointerMove(0, 0, {origin: target1})
.pointerMove(0, 0, {origin: btnCapture})
.pointerDown()
.pointerMove(0, 0, {origin: btnCapture})
.pointerMove(10, 0, {origin: btnCapture})
.pointerMove(0, 0, {origin: target1})
.pointerMove(0, 0, {origin: target0})
.pointerMove(0, 0, {origin: target1})
.pointerUp()
.pointerMove(0, 0, {origin: target1})
.send();
} }
</script> </script>
<h1>Pointer Events Capture Test</h1> <h1>Pointer Events Capture Test</h1>
......
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return mouseMoveIntoTarget('#target0').then(function() {
return mouseMoveIntoTarget('#target1');
}).then(function() {
return mouseDragInTargets(['#btnCapture', '#btnCapture', '#target1', '#target0', '#target1']);
}).then(function() {
return mouseMoveIntoTarget('#target1');
});
}
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