Bug 1565382 [wpt PR 17789] - Use testdriver Action API in WPT pointerevent tests - Part 10, a=testonly

Automatic update from web-platform-tests
Use testdriver Action API in WPT pointerevent tests - Part 10

In order to run the web-platform-tests automatically, we will use
testdriver Action API in all the wpt to simulate inputs. Here we are
changing some pointerevent input test which taps on the elements inside
an inner frame.

This is the tenth CL that changes part of the pointerevent input
tests.

Bug: 606367
Change-Id: Ib90c92e8267f17fed74a86d70ca6d739b5ccedb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1638914
Commit-Queue: Lan Wei <lanwei@chromium.org>
Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#675891}

--

wpt-commits: e6fff725295afce26b2000ab7644a69d29f78c08
wpt-pr: 17789
This commit is contained in:
Lan Wei 2019-07-22 11:06:06 +00:00 коммит произвёл James Graham
Родитель 705e3237f0
Коммит 68929883be
3 изменённых файлов: 48 добавлений и 2 удалений

Просмотреть файл

@ -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>
<script>
@ -95,6 +98,7 @@
var innerFrame = document.getElementById('innerFrame');
var square2 = innerFrame.contentDocument.getElementById('square2');
var rectSquare2 = square2.getBoundingClientRect();
var actions_promise;
eventList.forEach(function(eventName) {
on_event(square1, eventName, function (event) {
@ -112,10 +116,32 @@
checkPointerEventAttributes(event, rectSquare2, "Inner frame ");
if (Object.keys(detected_eventTypes).length == eventList.length) {
square2.style.visibility = 'hidden';
test_pointerEvent.done();
// Make sure the test finishes after all the input actions are completed.
actions_promise.then( () => {
test_pointerEvent.done();
});
}
});
});
// Inject mouse and pen inputs.
actions_promise = clickInTarget("mouse", square1).then(function() {
return moveToDocument("mouse");
}).then(function() {
return clickInTarget("mouse", square2);
}).then(function() {
return moveToDocument("mouse");
}).then(function() {
test_pointerEvent.done();
}).then(function() {
return clickInTarget("pen", square1);
}).then(function() {
return moveToDocument("pen");
}).then(function() {
return clickInTarget("pen", square2);
}).then(function() {
return moveToDocument("pen");
});
}
</script>
</head>

Просмотреть файл

@ -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>
<script>
@ -76,6 +79,7 @@
var innerFrame = document.getElementById('innerFrame');
var square2 = innerFrame.contentDocument.getElementById('square2');
var rectSquare2 = square2.getBoundingClientRect();
var actions_promise;
eventList.forEach(function(eventName) {
on_event(square1, eventName, function (event) {
@ -93,10 +97,18 @@
checkPointerEventAttributes(event, rectSquare2, "Inner frame ");
if (Object.keys(detected_eventTypes).length == eventList.length) {
square2.style.visibility = 'hidden';
test_pointerEvent.done();
// Make sure the test finishes after all the input actions are completed.
actions_promise.then( () => {
test_pointerEvent.done();
});
}
});
});
// Inject touch inputs.
actions_promise = clickInTarget("touch", square1).then(function() {
return clickInTarget("touch", square2);
});
}
</script>
</head>

Просмотреть файл

@ -353,3 +353,11 @@ function pointerHoverInTarget(pointerType, target, direction) {
.pointerMove(3 * x_delta, 3 * y_delta, {origin: target})
.send();
}
function moveToDocument(pointerType) {
var pointerId = pointerType + "Pointer1";
return new test_driver.Actions()
.addPointer(pointerId, pointerType)
.pointerMove(0, 0)
.send();
}