get-persistendeviceid-from-pointer-mouse-event.tentative.html (1443B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testdriver.js"></script> 5 <script src="/resources/testdriver-actions.js"></script> 6 <script src="/resources/testdriver-vendor.js"></script> 7 8 <style> 9 div { 10 user-select: none; // Prevents text selection on drag. 11 } 12 </style> 13 <div id="logger" draggable="false"></div> 14 <div id="console"></div> 15 <!-- This test documents the current behavior in Chrome for some 16 pointerType == "mouse" events --> 17 <script> 18 function CheckDeviceIdOne(event) { 19 assert_equals(event.persistentDeviceId, 1, event.type + " deviceId is 1"); 20 } 21 22 function CheckDeviceIdZero(event) { 23 assert_equals(event.persistentDeviceId, 0, event.type + " deviceId is 0"); 24 } 25 26 window.addEventListener("pointerdown", CheckDeviceIdOne, false); 27 window.addEventListener("pointermove", CheckDeviceIdOne, false); 28 window.addEventListener("pointerover", CheckDeviceIdOne, false); 29 window.addEventListener("pointerup", CheckDeviceIdOne, false); 30 window.addEventListener("click", CheckDeviceIdZero, false); 31 32 promise_test(async () => { 33 let actions = new test_driver.Actions() 34 .addPointer("TestPointer", "mouse") 35 .pointerDown() 36 .pointerMove(100, 100) 37 .pointerUp(); 38 39 await actions.send(); 40 41 }, 'PointerEvent.persistentDeviceId'); 42 </script>