Skip to content

Commit

Permalink
Use testdriver Action API in WPT pointerevent tests - Part 6
Browse files Browse the repository at this point in the history
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 tests which have touch, mouse and pen
inputs and complex actions.

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

Bug: 606367
Change-Id: I1e4a273fed440ba23f851a11f6e8c3eac8d18c77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1603786
Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
Commit-Queue: Lan Wei <lanwei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659943}
  • Loading branch information
LanWei22 authored and chromium-wpt-export-bot committed May 15, 2019
1 parent d7afcb8 commit dc5cede
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
Expand Up @@ -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>
Expand Down Expand Up @@ -33,6 +36,23 @@
on_event(target, "click", function (event) {
assert_unreached("click should not fire on disabled element");
});

// Inject touch inputs.
clickInTarget("mouse", target).then(function() {
return new test_driver.Actions()
.addPointer("mousePointer1", "mouse")
.pointerMove(0, 0)
.send();
}).then(function() {
return pointerDragInTarget('touch', target, 'right');
}).then(function() {
return clickInTarget("pen", target);
}).then(function() {
return new test_driver.Actions()
.addPointer("penPointer1", "pen")
.pointerMove(0, 0)
.send();
});
}
</script>
<style>
Expand Down
Expand Up @@ -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>
<script type="text/javascript" src="pointerevent_support.js"></script>
<script>
var detected_pointertypes = {};
Expand Down Expand Up @@ -102,6 +105,21 @@
});
test_pointerEvent.done();
});

// Inject mouse inputs.
new test_driver.Actions()
.pointerMove(0, 0, {origin: target0})
.pointerDown()
.pointerMove(0, 10, {origin: target0})
.pointerMove(0, 20, {origin: target0})
.pointerMove(0, -10, {origin: target1})
.pointerMove(0, 0, {origin: target1})
.pointerMove(0, 10, {origin: target1})
.pointerUp()
.pointerMove(0, 0, {origin: target1})
.pointerDown()
.pointerUp()
.send();
}
</script>
</head>
Expand Down
Expand Up @@ -8,6 +8,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 type="text/javascript" src="pointerevent_support.js"></script>
<script type="text/javascript">
var detected_pointertypes = {};
Expand All @@ -32,6 +35,7 @@
});

var target = document.getElementById("target");
var button = document.getElementById("done");

All_Pointer_Events.forEach(function(eventName) {
on_event(target, eventName, function (event) {
Expand All @@ -48,6 +52,19 @@
}
});
});

// Inject pointer inputs.
clickInTarget("mouse", target).then(function() {
return clickInTarget("mouse", button);
}).then(function() {
return clickInTarget("touch", target);
}).then(function() {
return clickInTarget("touch", button);
}).then(function() {
return clickInTarget("pen", target);
}).then(function() {
return clickInTarget("pen", button);
});
}
</script>
<style>
Expand Down

0 comments on commit dc5cede

Please sign in to comment.