Null dereference loading Blink layout test fast/loader/unload-mutation-crash.html
[WebKit-https.git] / LayoutTests / proximity / updates.html
1 <html>
2 <head>
3 <script src="../resources/js-test-pre.js"></script>
4 </head>
5 <body>
6 <script>
7 description('Tests that updates to the proximity causes new events to fire.');
8
9 var firedEvent;
10 function setProximity(value, min, max) {
11     firedEvent = {value: value, min: min, max: max};
12     internals.setDeviceProximity('webkitdeviceproximity', firedEvent.value, firedEvent.min, firedEvent.max);
13 }
14
15 var deviceProximityEvent;
16 function checkProximity(event) {
17     deviceProximityEvent = event;
18     shouldBe('deviceProximityEvent.value', 'firedEvent.value');
19     shouldBe('deviceProximityEvent.min', 'firedEvent.min');
20     shouldBe('deviceProximityEvent.max', 'firedEvent.max');
21 }
22
23 function firstListener(event) {
24     checkProximity(event);
25     window.removeEventListener('webkitdeviceproximity', firstListener);
26     window.addEventListener('webkitdeviceproximity', updateListener);
27     setProximity(22.2, 11.1, 33.3);
28 }
29
30 function updateListener(event) {
31     checkProximity(event);
32     finishJSTest();
33 }
34
35 window.addEventListener('webkitdeviceproximity', firstListener);
36 setProximity(2.2, 1.1, 3.3);
37 window.jsTestIsAsync = true;
38 </script>
39 <script src="../resources/js-test-post.js"></script>
40 </body>
41 </html>