OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE HTML> | |
2 <script src="../../../resources/testharness.js"></script> | |
3 <script src="../../../resources/testharnessreport.js"></script> | |
4 | |
5 <style> | |
6 div.box { | |
7 margin: 10px; | |
8 padding: 50px; | |
9 float: left; | |
10 } | |
11 </style> | |
12 | |
13 <script> | |
14 var receivedEvents = []; | |
15 | |
16 function testReceivedEvents(expectedEvents, testLabel) { | |
17 test(function() { | |
18 assert_array_equals(receivedEvents, expectedEvents); | |
19 }, testLabel); | |
20 receivedEvents = []; | |
21 } | |
22 | |
23 function init() { | |
24 var targetDiv = document.getElementById("target"); | |
25 targetEvents = ["mousedown", "mouseup", "mousemove", "contextmenu", | |
26 "mouseenter", "mouseleave", "mouseover", "mouseout", | |
27 "pointerdown", "pointerup", "pointermove", "pointercancel", | |
28 "pointerenter", "pointerleave", "pointerover", "pointerout"]; | |
29 | |
30 targetEvents.forEach(function(eventName) { | |
31 targetDiv.addEventListener(eventName, function(event) { | |
32 receivedEvents.push(event.type); | |
33 }); | |
34 }); | |
35 } | |
36 | |
37 function runTests() { | |
38 var rect = document.getElementById("target").getBoundingClientRect(); | |
39 eventSender.gestureLongPress(rect.left + 5, rect.top + 5); | |
40 testReceivedEvents([ | |
41 "mouseover", "mouseenter", "mousemove", "mousedown", "contextmenu" | |
42 ], "Long press events"); | |
43 | |
44 } | |
45 | |
46 function run() { | |
47 setup({explicit_done: true}); | |
48 | |
49 if (!window.eventSender) | |
50 assert_true(true, "No eventSender, skipped tests"); | |
51 else if (!window.PointerEvent) | |
52 assert_true(true, "No PointerEvent, skipped tests"); | |
53 else { | |
54 init(); | |
55 runTests(); | |
56 } | |
57 | |
58 done(); | |
59 } | |
60 </script> | |
61 | |
62 <body onload="run()"> | |
dtapuska
2016/07/18 21:16:31
is there a reason why this can't follow the
test(
mustaq
2016/07/19 15:50:27
Good catch. Don't recall why I originally did it f
| |
63 <h1>PointerEvent: Verifies that long press doesn't fire redundant pointer even ts</h1> | |
64 | |
65 <div id="target" class="box" style="background-color:red"></div> | |
66 | |
67 <div id="log"></div> | |
68 </body> | |
OLD | NEW |