OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../../resources/js-test.js"></script> | 3 <script src="../../../resources/js-test.js"></script> |
4 </head> | 4 </head> |
5 <body> | 5 <body> |
6 <script> | 6 <script> |
7 | 7 |
8 description('Tests using multiple event handlers for the Device Orientation API.
'); | 8 description('Tests using multiple event handlers for the Device Orientation API.
'); |
9 | 9 |
10 var mockEvent; | 10 var mockEvent; |
11 var expectedEvent; | 11 var expectedEvent; |
12 function setMockOrientation(alpha, beta, gamma, absolute) { | 12 function setMockOrientation(alpha, beta, gamma, absolute) { |
13 mockEvent = {alpha: alpha, beta: beta, gamma: gamma, absolute: absolute}; | 13 mockEvent = {alpha: alpha, beta: beta, gamma: gamma, absolute: absolute}; |
14 if (window.testRunner) | 14 if (window.testRunner) |
15 testRunner.setMockDeviceOrientation( | 15 testRunner.setMockDeviceOrientation( |
16 true, mockEvent.alpha, true, mockEvent.beta, true, mockEvent.gamma,
true, mockEvent.absolute); | 16 true, mockEvent.alpha, true, mockEvent.beta, true, mockEvent.gamma,
mockEvent.absolute); |
17 else | 17 else |
18 debug('This test can not be run without the TestRunner'); | 18 debug('This test can not be run without the TestRunner'); |
19 } | 19 } |
20 | 20 |
21 var deviceOrientationEvent; | 21 var deviceOrientationEvent; |
22 function checkOrientation(event) { | 22 function checkOrientation(event) { |
23 deviceOrientationEvent = event; | 23 deviceOrientationEvent = event; |
24 shouldBe('deviceOrientationEvent.alpha', 'expectedEvent.alpha'); | 24 shouldBe('deviceOrientationEvent.alpha', 'expectedEvent.alpha'); |
25 shouldBe('deviceOrientationEvent.beta', 'expectedEvent.beta'); | 25 shouldBe('deviceOrientationEvent.beta', 'expectedEvent.beta'); |
26 shouldBe('deviceOrientationEvent.gamma', 'expectedEvent.gamma'); | 26 shouldBe('deviceOrientationEvent.gamma', 'expectedEvent.gamma'); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 setMockOrientation(1, 2, 3, true); | 79 setMockOrientation(1, 2, 3, true); |
80 expectedEvent = mockEvent; | 80 expectedEvent = mockEvent; |
81 window.addEventListener('deviceorientation', firstListener); | 81 window.addEventListener('deviceorientation', firstListener); |
82 window.addEventListener('deviceorientation', secondListener); | 82 window.addEventListener('deviceorientation', secondListener); |
83 | 83 |
84 window.jsTestIsAsync = true; | 84 window.jsTestIsAsync = true; |
85 | 85 |
86 </script> | 86 </script> |
87 </body> | 87 </body> |
88 </html> | 88 </html> |
OLD | NEW |