зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1507258 [wpt PR 14059] - Modify the web platform tests with mouse inputs to use TestDriver, a=testonly
Automatic update from web-platform-tests Modify the web platform tests with mouse inputs to use TestDriver Since we have implemented test_driver Actions API, we will replace chrome.gpuBenchmarking.pointerActionSequence with this Actions API in all the tests. This CL will just replace the web platform tests with mouse inputs. Bug: 893480 Change-Id: Ie4eb7f4b8aaf23b2664182c5b8e814c7113dcf9a Reviewed-on: https://chromium-review.googlesource.com/c/1296823 Commit-Queue: Lan Wei <lanwei@chromium.org> Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org> Cr-Commit-Position: refs/heads/master@{#610898} -- wpt-commits: 54aa4d1e272558eaa65eaaa094c038fa4702331f wpt-pr: 14059
This commit is contained in:
Родитель
e35fcdf246
Коммит
439dedce9f
|
@ -6,6 +6,9 @@
|
|||
<link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
|
||||
<script src="/resources/testharness.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 -->
|
||||
<script type="text/javascript" src="pointerevent_support.js"></script>
|
||||
</head>
|
||||
|
@ -84,6 +87,8 @@
|
|||
test_pointermove0.done();
|
||||
event_log.push('pointermove@target0');
|
||||
pointermoveNoCaptureGot0 = true;
|
||||
// Second dispatch a pointer move to target1.
|
||||
new test_driver.Actions().pointerMove(0, 0, {origin: target1}).send();
|
||||
}
|
||||
if(isPointerCapture) {
|
||||
if(!pointermoveCaptureGot0) {
|
||||
|
@ -99,6 +104,8 @@
|
|||
}, "pointermove received for captured element while out of it");
|
||||
event_log.push('pointermove@target0');
|
||||
pointermoveCaptureGot0 = true;
|
||||
// Fourth dispatch a pointer move to target0.
|
||||
new test_driver.Actions().pointerMove(0, 0, {origin: target0}).send();
|
||||
}
|
||||
if((event.clientX > target0.getBoundingClientRect().left)&&
|
||||
(event.clientX < target0.getBoundingClientRect().right)&&
|
||||
|
@ -114,6 +121,9 @@
|
|||
}
|
||||
});
|
||||
|
||||
// First dispatch a pointer move to target0.
|
||||
new test_driver.Actions().pointerMove(0, 0, {origin: target0}).send();
|
||||
|
||||
on_event(target1, "pointermove", function (event) {
|
||||
if(isPointerCapture == true) {
|
||||
test(function() {
|
||||
|
@ -124,6 +134,14 @@
|
|||
test_pointermove1.done();
|
||||
event_log.push('pointermove@target1');
|
||||
pointermoveNoCaptureGot1 = true;
|
||||
// Third, drag the mouse from btnCapture, target1 to target0.
|
||||
new test_driver.Actions()
|
||||
.pointerMove(0, 0, {origin: btnCapture})
|
||||
.pointerDown()
|
||||
.pointerMove(0, 0, {origin: target1})
|
||||
.pointerMove(0, 0, {origin: target0})
|
||||
.pointerUp()
|
||||
.send();
|
||||
}
|
||||
});
|
||||
}
|
|
@ -7,6 +7,9 @@
|
|||
<link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
|
||||
<script src="/resources/testharness.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 -->
|
||||
<script type="text/javascript" src="pointerevent_support.js"></script>
|
||||
</head>
|
||||
|
@ -32,6 +35,9 @@
|
|||
eventTested = true;
|
||||
}
|
||||
});
|
||||
|
||||
// Inject the inputs to run this test.
|
||||
new test_driver.Actions().pointerMove(0, 0, {origin: target0}).send();
|
||||
}
|
||||
</script>
|
||||
<h1>Pointer Events pointermove Tests</h1>
|
|
@ -9,6 +9,9 @@
|
|||
<!-- /resources/testharness.js -->
|
||||
<script src="/resources/testharness.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 -->
|
||||
<script type="text/javascript" src="pointerevent_support.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
@ -46,6 +49,14 @@
|
|||
});
|
||||
test_pointerEvent.done(); // complete test
|
||||
});
|
||||
|
||||
// Dispatch a mouse drag in target0.
|
||||
new test_driver.Actions()
|
||||
.pointerMove(0, 0, {origin: target0})
|
||||
.pointerDown()
|
||||
.pointerMove(3, 3, {origin: target0})
|
||||
.pointerUp()
|
||||
.send();
|
||||
}
|
||||
</script>
|
||||
</head>
|
|
@ -7,6 +7,9 @@
|
|||
<link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
|
||||
<script src="/resources/testharness.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 -->
|
||||
<script type="text/javascript" src="pointerevent_support.js"></script>
|
||||
</head>
|
||||
|
@ -64,6 +67,15 @@
|
|||
test_pointermove.done();
|
||||
eventTested = true;
|
||||
});
|
||||
|
||||
// Click on both left and middle buttons.
|
||||
var actions = new test_driver.Actions();
|
||||
actions.pointerMove(0, 0, {origin: target0, button: actions.ButtonType.LEFT})
|
||||
.pointerDown({button: actions.ButtonType.LEFT})
|
||||
.pointerDown({button: actions.ButtonType.MIDDLE})
|
||||
.pointerUp({button: actions.ButtonType.MIDDLE})
|
||||
.pointerUp({button: actions.ButtonType.LEFT})
|
||||
.send();
|
||||
}
|
||||
</script>
|
||||
<h1>Pointer Events pointermove on button state changes Tests</h1>
|
|
@ -6,6 +6,9 @@
|
|||
<meta name="viewport" content="width=device-width">
|
||||
<script src="/resources/testharness.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>
|
||||
<script src="pointerevent_support.js"></script>
|
||||
</head>
|
||||
<body onload="run()">
|
||||
|
@ -33,8 +36,13 @@
|
|||
on_event(target0, "pointerover", function (event) {
|
||||
detected_pointertypes[event.pointerType] = true;
|
||||
target0.setPointerCapture(event.pointerId);
|
||||
// After we receive a pointerover event, dispatch a pointer move to move out of target0.
|
||||
new test_driver.Actions().pointerMove(0, 0).send();
|
||||
});
|
||||
|
||||
// First dispatch a pointer move to target0.
|
||||
new test_driver.Actions().pointerMove(0, 0, {origin: target0}).send();
|
||||
|
||||
// When the setPointerCapture method is invoked, if the specified pointer is not in active button state, then the method must have no effect on subsequent pointer events.
|
||||
// TA: 13.2
|
||||
on_event(target0, "pointerout", function (event) {
|
|
@ -22,6 +22,14 @@
|
|||
}
|
||||
|
||||
Actions.prototype = {
|
||||
ButtonType: {
|
||||
LEFT: 0,
|
||||
MIDDLE: 1,
|
||||
RIGHT: 2,
|
||||
BACK: 3,
|
||||
FORWARD: 4,
|
||||
},
|
||||
|
||||
/**
|
||||
* Generate the action sequence suitable for passing to
|
||||
* test_driver.action_sequence
|
||||
|
@ -98,7 +106,7 @@
|
|||
* @returns {Actions}
|
||||
*/
|
||||
addKeyboard: function(name, set=true) {
|
||||
this.createSource("key", name, true);
|
||||
this.createSource("key", name);
|
||||
if (set) {
|
||||
this.setKeyboard(name);
|
||||
}
|
||||
|
@ -125,7 +133,7 @@
|
|||
* @returns {Actions}
|
||||
*/
|
||||
addPointer: function(name, pointerType="mouse", set=true) {
|
||||
this.createSource("pointer", name, true, {pointerType: pointerType});
|
||||
this.createSource("pointer", name, {pointerType: pointerType});
|
||||
if (set) {
|
||||
this.setPointer(name);
|
||||
}
|
||||
|
@ -225,7 +233,7 @@
|
|||
* pointer source
|
||||
* @returns {Actions}
|
||||
*/
|
||||
pointerDown: function({button=0, sourceName=null}={}) {
|
||||
pointerDown: function({button=this.ButtonType.LEFT, sourceName=null}={}) {
|
||||
let source = this.getSource("pointer", sourceName);
|
||||
source.pointerDown(this, button);
|
||||
return this;
|
||||
|
@ -239,7 +247,7 @@
|
|||
* source
|
||||
* @returns {Actions}
|
||||
*/
|
||||
pointerUp: function({button=0, sourceName=null}={}) {
|
||||
pointerUp: function({button=this.ButtonType.LEFT, sourceName=null}={}) {
|
||||
let source = this.getSource("pointer", sourceName);
|
||||
source.pointerUp(this, button);
|
||||
return this;
|
||||
|
|
|
@ -192,7 +192,7 @@
|
|||
* @returns {Promise} fufiled after the actions are performed, or rejected in
|
||||
* the cases the WebDriver command errors
|
||||
*/
|
||||
action_sequence(actions) {
|
||||
action_sequence: function(actions) {
|
||||
return window.test_driver_internal.action_sequence(actions);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<script src="/resources/testharness.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>
|
||||
<script>
|
||||
var testMouseUp = async_test('Tests that the mouseup is preventable.');
|
||||
var received_back = false;
|
||||
|
@ -24,10 +27,21 @@
|
|||
testMouseUp.done();
|
||||
}
|
||||
});
|
||||
|
||||
function inject_input() {
|
||||
// First click on back button and then forward button.
|
||||
var actions = new test_driver.Actions();
|
||||
actions.pointerMove(0, 0, {origin: target})
|
||||
.pointerDown({button: actions.ButtonType.BACK})
|
||||
.pointerUp({button: actions.ButtonType.BACK})
|
||||
.pointerDown({button: actions.ButtonType.FORWARD})
|
||||
.pointerUp({button: actions.ButtonType.FORWARD})
|
||||
.send();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body id="target">
|
||||
<body id="target" onload="inject_input()">
|
||||
<h4>Test Description: Tests that the mouseup event is prevented.
|
||||
<ol>
|
||||
<li>Click the back mouse button</li>
|
Загрузка…
Ссылка в новой задаче