Add support for Device Orientation / Motion permission API
[WebKit-https.git] / LayoutTests / fast / device-orientation / device-motion-request-permission-denied.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../resources/js-test.js"></script>
5 <script>
6 description("Basic testing for DeviceMotionEvent.requestPermission().");
7 jsTestIsAsync = true;
8
9 if (window.testRunner)
10     testRunner.setShouldAllowDeviceOrientationAndMotionAccess(false);
11
12 addEventListener("devicemotion", () => {});
13
14 internals.withUserGesture(() => {
15     DeviceMotionEvent.requestPermission().then((_result) => {
16         result = _result;
17         shouldBeEqualToString("result", "denied");
18
19         addEventListener("devicemotion", () => {});
20
21         internals.withUserGesture(() => {
22             DeviceMotionEvent.requestPermission().then((_result) => {
23                 result = _result;
24                 shouldBeEqualToString("result", "denied");
25                 finishJSTest();
26             });
27         });
28     });
29 });
30 </script>
31 </body>
32 </html>