Commit 0a8f3ffa authored by Lan Wei's avatar Lan Wei Committed by Commit Bot

Use testdriver Action API in WPT pointerevent touch tests - Part 2

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 touch input tests which are doing scrolling.

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

Bug: 606367
Change-Id: I67cc6c401a22de59af298133021f380baa7d4b19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1473971
Commit-Queue: Lan Wei <lanwei@chromium.org>
Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#645386}
parent 74519dea
...@@ -285,3 +285,12 @@ function touchScrollInTarget(target, direction) { ...@@ -285,3 +285,12 @@ function touchScrollInTarget(target, direction) {
.pointerUp() .pointerUp()
.send(); .send();
} }
function touchTapInTarget(target) {
return new test_driver.Actions()
.addPointer("pointer1", "touch")
.pointerMove(0, 0, {origin: target})
.pointerDown()
.pointerUp()
.send();
}
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,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>
<script src="pointerevent_support.js"></script> <script src="pointerevent_support.js"></script>
<style> <style>
.scroller > div { .scroller > div {
...@@ -89,6 +92,7 @@ ...@@ -89,6 +92,7 @@
function run() { function run() {
var target0 = document.getElementById("target0"); var target0 = document.getElementById("target0");
var btnComplete = document.getElementById("btnComplete"); var btnComplete = document.getElementById("btnComplete");
var clickIsReceived = false;
// Check if touch-action attribute works properly for embedded divs // Check if touch-action attribute works properly for embedded divs
// Scrollable-Parent, Child: `auto`, Grand-Child: `none` // Scrollable-Parent, Child: `auto`, Grand-Child: `none`
...@@ -99,13 +103,25 @@ ...@@ -99,13 +103,25 @@
assert_equals(target0.scrollLeft, 0, "scroll x offset should be 0 in the end of the test"); assert_equals(target0.scrollLeft, 0, "scroll x offset should be 0 in the end of the test");
assert_equals(target0.scrollTop, 0, "scroll y offset should be 0 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(); clickIsReceived = true;
updateDescriptionComplete(); updateDescriptionComplete();
}); });
on_event(target0, 'scroll', function(event) { on_event(target0, 'scroll', function(event) {
test_touchaction.step(failOnScroll, "scroll received while touch-action is none"); test_touchaction.step(failOnScroll, "scroll received while touch-action is none");
}); });
// Inject touch inputs.
touchScrollInTarget(scrollTarget, 'down').then(function() {
return touchScrollInTarget(scrollTarget, 'right');
}).then(function() {
return touchTapInTarget(btnComplete);
}).then(function() {
test_touchaction.step(function () {
assert_true(clickIsReceived, "click should be received before the test finishes");
}, "click should be received before the test finishes");
test_touchaction.done();
});
} }
</script> </script>
<h1>behaviour: none</h1> <h1>behaviour: none</h1>
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,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>
<script src="pointerevent_support.js"></script> <script src="pointerevent_support.js"></script>
<style> <style>
.scroller > div { .scroller > div {
...@@ -84,6 +87,7 @@ ...@@ -84,6 +87,7 @@
function run() { function run() {
var target0 = document.getElementById("target0"); var target0 = document.getElementById("target0");
var btnComplete = document.getElementById("btnComplete"); var btnComplete = document.getElementById("btnComplete");
var clickIsReceived = false;
// Check if touch-action attribute works properly for embedded divs // Check if touch-action attribute works properly for embedded divs
// //
...@@ -94,13 +98,25 @@ ...@@ -94,13 +98,25 @@
assert_equals(target0.scrollLeft, 0, "scroll x offset should be 0 in the end of the test"); assert_equals(target0.scrollLeft, 0, "scroll x offset should be 0 in the end of the test");
assert_equals(target0.scrollTop, 0, "scroll y offset should be 0 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(); clickIsReceived = true;
updateDescriptionComplete(); updateDescriptionComplete();
}); });
on_event(target0, 'scroll', function(event) { on_event(target0, 'scroll', function(event) {
test_touchaction.step(failOnScroll, "scroll received while touch-action is none"); test_touchaction.step(failOnScroll, "scroll received while touch-action is none");
}); });
// Inject touch inputs.
touchScrollInTarget(scrollTarget, 'down').then(function() {
return touchScrollInTarget(scrollTarget, 'right');
}).then(function() {
return touchTapInTarget(btnComplete);
}).then(function() {
test_touchaction.step(function () {
assert_true(clickIsReceived, "click should be received before the test finishes");
}, "click should be received before the test finishes");
test_touchaction.done();
});
} }
</script> </script>
<h1>behaviour: none</h1> <h1>behaviour: none</h1>
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,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>
<script src="pointerevent_support.js"></script> <script src="pointerevent_support.js"></script>
<style> <style>
.scroller > div { .scroller > div {
...@@ -88,6 +91,7 @@ ...@@ -88,6 +91,7 @@
function run() { function run() {
var target0 = document.getElementById("target0"); var target0 = document.getElementById("target0");
var btnComplete = document.getElementById("btnComplete"); var btnComplete = document.getElementById("btnComplete");
var clickIsReceived = false;
// Check if touch-action attribute works properly for embedded divs // Check if touch-action attribute works properly for embedded divs
// //
...@@ -98,9 +102,21 @@ ...@@ -98,9 +102,21 @@
assert_not_equals(target0.scrollLeft, 0, "scroll x offset should not be 0 in the end of the test"); assert_not_equals(target0.scrollLeft, 0, "scroll x offset should not be 0 in the end of the test");
assert_equals(target0.scrollTop, 0, "scroll y offset should be 0 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(); clickIsReceived = true;
updateDescriptionComplete(); updateDescriptionComplete();
}); });
// Inject touch inputs.
touchScrollInTarget(scrollTarget, 'down').then(function() {
return touchScrollInTarget(scrollTarget, 'right');
}).then(function() {
return touchTapInTarget(btnComplete);
}).then(function() {
test_touchaction.step(function () {
assert_true(clickIsReceived, "click should be received before the test finishes");
}, "click should be received before the test finishes");
test_touchaction.done();
});
} }
</script> </script>
<h1>behaviour: pan-x</h1> <h1>behaviour: pan-x</h1>
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,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>
<script src="pointerevent_support.js"></script> <script src="pointerevent_support.js"></script>
<style> <style>
.scroller > div { .scroller > div {
...@@ -89,6 +92,7 @@ ...@@ -89,6 +92,7 @@
function run() { function run() {
var target0 = document.getElementById("target0"); var target0 = document.getElementById("target0");
var btnComplete = document.getElementById("btnComplete"); var btnComplete = document.getElementById("btnComplete");
var clickIsReceived = false;
// Check if touch-action attribute works properly for embedded divs // Check if touch-action attribute works properly for embedded divs
// Scrollable-Parent, Child: `pan-x`, Grand-Child: `pan-y` // Scrollable-Parent, Child: `pan-x`, Grand-Child: `pan-y`
...@@ -99,13 +103,25 @@ ...@@ -99,13 +103,25 @@
assert_equals(target0.scrollLeft, 0, "scroll x offset should be 0 in the end of the test"); assert_equals(target0.scrollLeft, 0, "scroll x offset should be 0 in the end of the test");
assert_equals(target0.scrollTop, 0, "scroll y offset should be 0 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(); clickIsReceived = true;
updateDescriptionComplete(); updateDescriptionComplete();
}); });
on_event(target0, 'scroll', function(event) { on_event(target0, 'scroll', function(event) {
test_touchaction.step(failOnScroll, "scroll received while touch-action is none"); test_touchaction.step(failOnScroll, "scroll received while touch-action is none");
}); });
// Inject touch inputs.
touchScrollInTarget(scrollTarget, 'down').then(function() {
return touchScrollInTarget(scrollTarget, 'right');
}).then(function() {
return touchTapInTarget(btnComplete);
}).then(function() {
test_touchaction.step(function () {
assert_true(clickIsReceived, "click should be received before the test finishes");
}, "click should be received before the test finishes");
test_touchaction.done();
});
} }
</script> </script>
<h1>behaviour: none</h1> <h1>behaviour: none</h1>
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,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>
<script src="pointerevent_support.js"></script> <script src="pointerevent_support.js"></script>
<style> <style>
.scroller { .scroller {
...@@ -84,6 +87,7 @@ ...@@ -84,6 +87,7 @@
function run() { function run() {
var target0 = document.getElementById("target0"); var target0 = document.getElementById("target0");
var btnComplete = document.getElementById("btnComplete"); var btnComplete = document.getElementById("btnComplete");
var clickIsReceived = false;
// Check if touch-action attribute works properly for embedded divs // Check if touch-action attribute works properly for embedded divs
// //
...@@ -94,13 +98,25 @@ ...@@ -94,13 +98,25 @@
assert_equals(target0.scrollLeft, 0, "scroll x offset should be 0 in the end of the test"); assert_equals(target0.scrollLeft, 0, "scroll x offset should be 0 in the end of the test");
assert_equals(target0.scrollTop, 0, "scroll y offset should be 0 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(); clickIsReceived = true;
updateDescriptionComplete(); updateDescriptionComplete();
}); });
on_event(target0, 'scroll', function(event) { on_event(target0, 'scroll', function(event) {
test_touchaction.step(failOnScroll, "scroll received while touch-action is none"); test_touchaction.step(failOnScroll, "scroll received while touch-action is none");
}); });
// Inject touch inputs.
touchScrollInTarget(scrollTarget, 'down').then(function() {
return touchScrollInTarget(scrollTarget, 'right');
}).then(function() {
return touchTapInTarget(btnComplete);
}).then(function() {
test_touchaction.step(function () {
assert_true(clickIsReceived, "click should be received before the test finishes");
}, "click should be received before the test finishes");
test_touchaction.done();
});
} }
</script> </script>
<h1>behaviour: none</h1> <h1>behaviour: none</h1>
......
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return touchScrollInTarget('#target0 > div > div', 'down').then(function() {
return touchScrollInTarget('#target0 > div > div', 'right');
}).then(function() {
return touchTapInTarget('#btnComplete');
});
}
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return touchScrollInTarget('#target0 > div', 'down').then(function() {
return touchScrollInTarget('#target0 > div', 'right');
}).then(function() {
return touchTapInTarget('#btnComplete');
});
}
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return touchScrollInTarget('#target0 > div > div', 'down').then(function() {
return touchScrollInTarget('#target0 > div > div', 'right');
}).then(function() {
return touchTapInTarget('#btnComplete');
});
}
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return touchScrollInTarget('#target0 > div > div', 'down').then(function() {
return touchScrollInTarget('#target0 > div > div', 'right');
}).then(function() {
return touchTapInTarget('#btnComplete');
});
}
importAutomationScript('/pointerevents/pointerevent_common_input.js');
function inject_input() {
return touchScrollInTarget('#target0 > div', 'down').then(function() {
return touchScrollInTarget('#target0 > div', 'right');
}).then(function() {
return touchTapInTarget('#btnComplete');
});
}
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