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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/touch/script-tests/document-create-touch-list.js

Issue 2182183003: Remove |TouchEvent.initTouchEvent()| in M54 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 description("This tests support for the document.createTouchList API."); 1 description("This tests support for the document.createTouchList API.");
2 2
3 shouldBeTrue('"createTouchList" in document'); 3 shouldBeTrue('"createTouchList" in document');
4 4
5 // Test createTouchList with no arguments. 5 // Test createTouchList with no arguments.
6 var touchList = document.createTouchList(); 6 var touchList = document.createTouchList();
7 shouldBeNonNull("touchList"); 7 shouldBeNonNull("touchList");
8 shouldBe("touchList.length", "0"); 8 shouldBe("touchList.length", "0");
9 shouldBeNull("touchList.item(0)"); 9 shouldBeNull("touchList.item(0)");
10 shouldBeNull("touchList.item(1)"); 10 shouldBeNull("touchList.item(1)");
11 shouldThrow("touchList.item()"); 11 shouldThrow("touchList.item()");
12 12
13 // Test createTouchList with Touch objects as arguments. 13 // Test createTouchList with Touch objects as arguments.
14 try { 14 try {
15 var t = document.createTouch(window, document.body, 12341, 60, 65, 100, 105) ; 15 var t = document.createTouch(window, document.body, 12341, 60, 65, 100, 105) ;
16 var t2 = document.createTouch(window, document.body, 12342, 50, 55, 115, 120 ); 16 var t2 = document.createTouch(window, document.body, 12342, 50, 55, 115, 120 );
17 var tl = document.createTouchList(t, t2); 17 var tl = document.createTouchList(t, t2);
18 18
19 var evt = document.createEvent("TouchEvent"); 19 var evt = new TouchEvent("touchstart", {
20 evt.initTouchEvent(tl, tl, tl, "touchstart", window, 0, 0, 0, 0, true, false , false, false); 20 view: window,
21 touches: tl,
22 targetTouches: tl,
23 changedTouches: tl,
24 ctrlKey: true,
25 });
21 26
22 document.body.addEventListener("touchstart", function handleTouchStart(ev) { 27 document.body.addEventListener("touchstart", function handleTouchStart(ev) {
23 ts = ev; 28 ts = ev;
24 shouldBeTrue("ts instanceof TouchEvent"); 29 shouldBeTrue("ts instanceof TouchEvent");
25 shouldBeTrue("ts.touches instanceof TouchList"); 30 shouldBeTrue("ts.touches instanceof TouchList");
26 shouldBe("ts.touches.length", "2"); 31 shouldBe("ts.touches.length", "2");
27 shouldBeTrue("ts.touches[0] instanceof Touch"); 32 shouldBeTrue("ts.touches[0] instanceof Touch");
28 shouldBe("ts.touches[0].identifier", "12341"); 33 shouldBe("ts.touches[0].identifier", "12341");
29 shouldBe("ts.touches[0].clientX", "60"); 34 shouldBe("ts.touches[0].clientX", "60");
30 shouldBe("ts.touches[1].screenY", "120"); 35 shouldBe("ts.touches[1].screenY", "120");
31 shouldBe("ts.ctrlKey", "true"); 36 shouldBe("ts.ctrlKey", "true");
32 }); 37 });
33 38
34 document.body.dispatchEvent(evt); 39 document.body.dispatchEvent(evt);
35 } catch(e) { 40 } catch(e) {
36 testFailed("An exception was thrown: " + e.message); 41 testFailed("An exception was thrown: " + e.message);
37 } 42 }
38 43
39 // Test createTouchList with invalid arguments which throws exceptions. 44 // Test createTouchList with invalid arguments which throws exceptions.
40 try { 45 try {
41 var tl = document.createTouchList(1, 2); 46 var tl = document.createTouchList(1, 2);
42 } catch(e) { 47 } catch(e) {
43 testPassed("An exception was thrown: " + e.message); 48 testPassed("An exception was thrown: " + e.message);
44 } 49 }
45 isSuccessfullyParsed(); 50 isSuccessfullyParsed();
46 51
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698