no-synchronous-events.https.html (875B)
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-vendor.js"></script> 6 <script src="../resources/orientation-event-helpers.js"></script> 7 <script> 8 'use strict'; 9 10 promise_test(async (t) => { 11 const helper = new SensorTestHelper(t, 'deviceorientation'); 12 await helper.grantSensorsPermissions(); 13 await helper.initializeSensors(); 14 15 const orientationData = generateOrientationData(1.1, 2.2, 3.3, false); 16 await helper.setData(orientationData); 17 18 return new Promise((resolve, reject) => { 19 let result = reject; 20 window.addEventListener('deviceorientation', event => result()); 21 result = resolve; 22 }); 23 }, 'Tests that events are never fired synchronously from a call to window.addEventListener().'); 24 </script>