Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/pointerevents/pointerevent_support.js

Issue 2322083002: Import wpt@e1ad3cc6894b20da0a5d7dddf431c9e7848d0544 (Closed)
Patch Set: Add mac exception and rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/pointerevents/pointerevent_support.js
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/pointerevents/pointerevent_support.js b/third_party/WebKit/LayoutTests/imported/wpt/pointerevents/pointerevent_support.js
index 2f43118f783b3bd4e8412617236919a6e25f63dc..a7233fe90843831434fc5c792572414cbf609640 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt/pointerevents/pointerevent_support.js
+++ b/third_party/WebKit/LayoutTests/imported/wpt/pointerevents/pointerevent_support.js
@@ -15,7 +15,16 @@ var All_Pointer_Events = [
function check_PointerEvent(event, testNamePrefix) {
if (testNamePrefix === undefined)
testNamePrefix = "";
- var pointerTestName = testNamePrefix + ' ' + event.pointerType + ' ' + event.type;
+
+ // Use expectedPointerType if set otherwise just use the incoming event pointerType in the test name.
+ var pointerTestName = testNamePrefix + ' ' + (expectedPointerType == null ? event.pointerType : expectedPointerType) + ' ' + event.type;
+
+ if (expectedPointerType != null) {
+ test(function () {
+ assert_equals(event.pointerType, expectedPointerType, "pointerType should be the same as the requested device.");
+ }, pointerTestName + " event pointerType is correct.");
+ }
+
test(function () {
assert_true(event instanceof event.target.ownerDocument.defaultView.PointerEvent, "event is a PointerEvent event");
}, pointerTestName + " event is a PointerEvent event");
@@ -92,11 +101,12 @@ function check_PointerEvent(event, testNamePrefix) {
}
}, pointerTestName + ".pressure value is valid");
-
// Check mouse-specific properties
if (event.pointerType === "mouse") {
// TA: 1.9, 1.10, 1.13
test(function () {
+ assert_equals(event.width, 1, "width of mouse should be 1");
+ assert_equals(event.height, 1, "height of mouse should be 1");
assert_equals(event.tiltX, 0, event.type + ".tiltX is 0 for mouse");
assert_equals(event.tiltY, 0, event.type + ".tiltY is 0 for mouse");
assert_true(event.isPrimary, event.type + ".isPrimary is true for mouse");
@@ -185,3 +195,46 @@ function rPointerCapture(e) {
catch(e) {
}
}
+
+var globalPointerEventTest = null;
+var expectedPointerType = null;
+var HOVERABLE_POINTERS = ['mouse', 'pen'];
+
+function MultiPointerTypeTest(testName, types) {
+ this.testName = testName;
+ this.types = types;
+ this.currentTypeIndex = 0;
+ this.currentTest = null;
+ this.createNextTest();
+}
+
+MultiPointerTypeTest.prototype.skip = function() {
+ var prevTest = this.currentTest;
+ this.createNextTest();
+ prevTest.timeout();
+}
+
+MultiPointerTypeTest.prototype.done = function() {
+ var prevTest = this.currentTest;
+ this.createNextTest();
+ if (prevTest != null)
+ prevTest.done();
+}
+
+MultiPointerTypeTest.prototype.createNextTest = function() {
+ if (this.currentTypeIndex < this.types.length) {
+ var pointerTypeDescription = document.getElementById('pointerTypeDescription');
+ document.getElementById('pointerTypeDescription').innerHTML = "Follow the test instructions with <span style='color: red'>" + this.types[this.currentTypeIndex] + "</span>. If you don't have the device <a href='javascript:;' onclick='globalPointerEventTest.skip()'>skip it</a>.";
+ this.currentTest = async_test(this.types[this.currentTypeIndex] + ' ' + this.testName);
+ expectedPointerType = this.types[this.currentTypeIndex];
+ this.currentTypeIndex++;
+ } else {
+ document.getElementById('pointerTypeDescription').innerHTML = "";
+ }
+ resetTestState();
+}
+
+
+function setup_pointerevent_test(testName, supportedPointerTypes) {
+ return globalPointerEventTest = new MultiPointerTypeTest(testName, supportedPointerTypes);
+}

Powered by Google App Engine
This is Rietveld 408576698