Commit a1f2fa63 authored by Lan Wei's avatar Lan Wei Committed by Commit Bot

Use testdriver Action API in WPT pointerevents/extension tests

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 touch input tests with touch action in
pointerevents/extension.

Bug: 606367
Change-Id: Icd5b11236bf3ec575cb93b7cb7403cea1f983034
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1704690Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Commit-Queue: Lan Wei <lanwei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678281}
parent d87ab22e
......@@ -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>
<script src="../pointerevent_support.js"></script>
<style>
#target0 {
......@@ -83,6 +86,7 @@
function run() {
var target0 = document.getElementById("target0");
var btnComplete = document.getElementById("btnComplete");
var actions_promise;
target0.scrollTop = 200;
var scrollListenerExecuted = false;
......@@ -100,9 +104,22 @@
assert_equals(target0.scrollLeft, 0, "scroll x offset should be 0 in the end of the test");
assert_greater_than(target0.scrollTop, 200, "scroll y offset should be greater than 200 in the end of the test");
});
test_touchaction.done();
// Make sure the test finishes after all the input actions are completed.
actions_promise.then( () => {
test_touchaction.done();
});
updateDescriptionComplete();
});
// Inject touch inputs.
actions_promise = touchScrollInTarget(target0, 'up').then(function() {
return touchScrollInTarget(target0, 'right');
}).then(function() {
return touchScrollInTarget(target0, 'down');
}).then(function() {
return clickInTarget("touch", btnComplete);
});
}
</script>
<h1>touch-action: pan-down</h1>
......
......@@ -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>
<script src="../pointerevent_support.js"></script>
<style>
#target0 {
......@@ -83,6 +86,7 @@
function run() {
var target0 = document.getElementById("target0");
var btnComplete = document.getElementById("btnComplete");
var actions_promise;
target0.scrollLeft = 200;
var scrollListenerExecuted = false;
......@@ -100,9 +104,22 @@
assert_less_than(target0.scrollLeft, 200, "scroll x offset should be less than 200 in the end of the test");
assert_equals(target0.scrollTop, 0, "scroll y offset should be 0 in the end of the test");
});
test_touchaction.done();
// Make sure the test finishes after all the input actions are completed.
actions_promise.then( () => {
test_touchaction.done();
});
updateDescriptionComplete();
});
// Inject touch inputs.
actions_promise = touchScrollInTarget(target0, 'down').then(function() {
return touchScrollInTarget(target0, 'right');
}).then(function() {
return touchScrollInTarget(target0, 'left');
}).then(function() {
return clickInTarget("touch", btnComplete);
});
}
</script>
<h1>touch-action: pan-left</h1>
......
......@@ -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>
<script src="../pointerevent_support.js"></script>
<style>
#target0 {
......@@ -83,6 +86,7 @@
function run() {
var target0 = document.getElementById("target0");
var btnComplete = document.getElementById("btnComplete");
var actions_promise;
target0.scrollLeft = 200;
var scrollListenerExecuted = false;
......@@ -100,9 +104,22 @@
assert_greater_than(target0.scrollLeft, 200, "scroll x offset should be greater than 200 in the end of the test");
assert_equals(target0.scrollTop, 0, "scroll y offset should be 0 in the end of the test");
});
test_touchaction.done();
// Make sure the test finishes after all the input actions are completed.
actions_promise.then( () => {
test_touchaction.done();
});
updateDescriptionComplete();
});
// Inject touch inputs.
actions_promise = touchScrollInTarget(target0, 'down').then(function() {
return touchScrollInTarget(target0, 'left');
}).then(function() {
return touchScrollInTarget(target0, 'right');
}).then(function() {
return clickInTarget("touch", btnComplete);
});
}
</script>
<h1>touch-action: pan-right</h1>
......
......@@ -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>
<script src="../pointerevent_support.js"></script>
<style>
#target0 {
......@@ -83,6 +86,7 @@
function run() {
var target0 = document.getElementById("target0");
var btnComplete = document.getElementById("btnComplete");
var actions_promise;
target0.scrollTop = 200;
var scrollListenerExecuted = false;
......@@ -100,9 +104,22 @@
assert_equals(target0.scrollLeft, 0, "scroll x offset should be 0 in the end of the test");
assert_less_than(target0.scrollTop, 200, "scroll y offset should be less than 200 in the end of the test");
});
test_touchaction.done();
// Make sure the test finishes after all the input actions are completed.
actions_promise.then( () => {
test_touchaction.done();
});
updateDescriptionComplete();
});
// Inject touch inputs.
actions_promise = touchScrollInTarget(target0, 'down').then(function() {
return touchScrollInTarget(target0, 'right');
}).then(function() {
return touchScrollInTarget(target0, 'up');
}).then(function() {
return clickInTarget("touch", btnComplete);
});
}
</script>
<h1>touch-action: pan-up</h1>
......
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return mouseMoveIntoTarget('#target0').then(function() {
return mouseChordedButtonPress('#target0');
});
}
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return touchScrollInTarget('#target0', 'up').then(function() {
return touchScrollInTarget('#target0', 'right');
}).then(function() {
return touchScrollInTarget('#target0', 'down');
}).then(function() {
btnComplete.click();
});
}
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return touchScrollInTarget('#target0', 'down').then(function() {
return touchScrollInTarget('#target0', 'right');
}).then(function() {
return touchScrollInTarget('#target0', 'left');
}).then(function() {
return touchTapInTarget('#btnComplete');
});
}
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return touchScrollInTarget('#target0', 'down').then(function() {
return touchScrollInTarget('#target0', 'left');
}).then(function() {
return touchScrollInTarget('#target0', 'right');
}).then(function() {
return touchTapInTarget('#btnComplete');
});
}
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return touchScrollInTarget('#target0', 'down').then(function() {
return touchScrollInTarget('#target0', 'right');
}).then(function() {
return touchScrollInTarget('#target0', 'up');
}).then(function() {
btnComplete.click();
});
}
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