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

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

Issue 2572333003: Import wpt@4970d7334aaf8977c5b617075aa48be1b6e482c7 (Closed)
Patch Set: Update TestExpectations Created 4 years 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 unified diff | Download patch
OLDNEW
1 var All_Pointer_Events = [ 1 var All_Pointer_Events = [
2 "pointerdown", 2 "pointerdown",
3 "pointerup", 3 "pointerup",
4 "pointercancel", 4 "pointercancel",
5 "pointermove", 5 "pointermove",
6 "pointerover", 6 "pointerover",
7 "pointerout", 7 "pointerout",
8 "pointerenter", 8 "pointerenter",
9 "pointerleave", 9 "pointerleave",
10 "gotpointercapture", 10 "gotpointercapture",
11 "lostpointercapture"]; 11 "lostpointercapture"];
12 12
13 // Check for conformance to PointerEvent interface 13 // Check for conformance to PointerEvent interface
14 // TA: 1.1, 1.2, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 1.12, 1.13 14 // TA: 1.1, 1.2, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 1.12, 1.13
15 function check_PointerEvent(event, testNamePrefix) { 15 function check_PointerEvent(event, testNamePrefix) {
16 if (testNamePrefix === undefined) 16 if (testNamePrefix === undefined)
17 testNamePrefix = ""; 17 testNamePrefix = "";
18 18
19 // Use expectedPointerType if set otherwise just use the incoming event poin terType in the test name. 19 // Use expectedPointerType if set otherwise just use the incoming event poin terType in the test name.
20 var pointerTestName = testNamePrefix + ' ' + (expectedPointerType == null ? event.pointerType : expectedPointerType) + ' ' + event.type; 20 var pointerTestName = testNamePrefix + ' ' + (expectedPointerType == null ? event.pointerType : expectedPointerType) + ' ' + event.type;
21 21
22 if (expectedPointerType != null) { 22 if (expectedPointerType != null) {
23 test(function () { 23 test(function () {
24 assert_equals(event.pointerType, expectedPointerType, "pointerType s hould be the same as the requested device."); 24 assert_equals(event.pointerType, expectedPointerType, "pointerType s hould be the one specified in the test page.");
25 }, pointerTestName + " event pointerType is correct."); 25 }, pointerTestName + " event pointerType is correct.");
26 } 26 }
27 27
28 test(function () { 28 test(function () {
29 assert_true(event instanceof event.target.ownerDocument.defaultView.Poin terEvent, "event is a PointerEvent event"); 29 assert_true(event instanceof event.target.ownerDocument.defaultView.Poin terEvent, "event is a PointerEvent event");
30 }, pointerTestName + " event is a PointerEvent event"); 30 }, pointerTestName + " event is a PointerEvent event");
31 31
32 32
33 // Check attributes for conformance to WebIDL: 33 // Check attributes for conformance to WebIDL:
34 // * attribute exists 34 // * attribute exists
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 try { 194 try {
195 captureButton.value = 'Set Capture'; 195 captureButton.value = 'Set Capture';
196 target0.releasePointerCapture(e.pointerId); 196 target0.releasePointerCapture(e.pointerId);
197 } 197 }
198 catch(e) { 198 catch(e) {
199 } 199 }
200 } 200 }
201 201
202 var globalPointerEventTest = null; 202 var globalPointerEventTest = null;
203 var expectedPointerType = null; 203 var expectedPointerType = null;
204 const ALL_POINTERS = ['mouse', 'touch', 'pen'];
204 const HOVERABLE_POINTERS = ['mouse', 'pen']; 205 const HOVERABLE_POINTERS = ['mouse', 'pen'];
205 const NOHOVER_POINTERS = ['touch']; 206 const NOHOVER_POINTERS = ['touch'];
206 207
207 function MultiPointerTypeTest(testName, types) { 208 function MultiPointerTypeTest(testName, types) {
208 this.testName = testName; 209 this.testName = testName;
209 this.types = types; 210 this.types = types;
210 this.currentTypeIndex = 0; 211 this.currentTypeIndex = 0;
211 this.currentTest = null; 212 this.currentTest = null;
212 this.createNextTest(); 213 this.createNextTest();
213 } 214 }
(...skipping 19 matching lines...) Expand all
233 expectedPointerType = this.types[this.currentTypeIndex]; 234 expectedPointerType = this.types[this.currentTypeIndex];
234 this.currentTypeIndex++; 235 this.currentTypeIndex++;
235 } else { 236 } else {
236 document.getElementById('pointerTypeDescription').innerHTML = ""; 237 document.getElementById('pointerTypeDescription').innerHTML = "";
237 } 238 }
238 resetTestState(); 239 resetTestState();
239 } 240 }
240 241
241 242
242 function setup_pointerevent_test(testName, supportedPointerTypes) { 243 function setup_pointerevent_test(testName, supportedPointerTypes) {
243 return globalPointerEventTest = new MultiPointerTypeTest(testName, supportedP ointerTypes); 244 return globalPointerEventTest = new MultiPointerTypeTest(testName, supported PointerTypes);
244 } 245 }
246
247 function checkPointerEventType(event) {
248 assert_equals(event.pointerType, expectedPointerType, "pointerType should be the same as the requested device.");
249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698