OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 <script> | 5 <script> |
6 description('Tests using null values for some of the event properties.'); | 6 description('Tests using null values for some of the event properties.'); |
7 | 7 |
8 var mockEvent; | 8 var mockEvent; |
9 function setMockOrientation(alpha, beta, gamma, absolute) { | 9 function setMockOrientation(alpha, beta, gamma, absolute) { |
10 mockEvent = {alpha: alpha, beta: beta, gamma: gamma, absolute: absolute}; | 10 mockEvent = {alpha: alpha, beta: beta, gamma: gamma, absolute: absolute}; |
11 if (window.testRunner) | 11 if (window.testRunner) |
12 testRunner.setMockDeviceOrientation( | 12 testRunner.setMockDeviceOrientation( |
13 null != mockEvent.alpha, null == mockEvent.alpha ? 0 : mockEvent.alp
ha, | 13 null != mockEvent.alpha, null == mockEvent.alpha ? 0 : mockEvent.alp
ha, |
14 null != mockEvent.beta, null == mockEvent.beta ? 0 : mockEvent.beta, | 14 null != mockEvent.beta, null == mockEvent.beta ? 0 : mockEvent.beta, |
15 null != mockEvent.gamma, null == mockEvent.gamma ? 0 : mockEvent.gam
ma, | 15 null != mockEvent.gamma, null == mockEvent.gamma ? 0 : mockEvent.gam
ma, |
16 null != mockEvent.absolute, null == mockEvent.absolute ? false : moc
kEvent.absolute); | 16 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', 'mockEvent.alpha'); | 24 shouldBe('deviceOrientationEvent.alpha', 'mockEvent.alpha'); |
25 shouldBe('deviceOrientationEvent.beta', 'mockEvent.beta'); | 25 shouldBe('deviceOrientationEvent.beta', 'mockEvent.beta'); |
26 shouldBe('deviceOrientationEvent.gamma', 'mockEvent.gamma'); | 26 shouldBe('deviceOrientationEvent.gamma', 'mockEvent.gamma'); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 finishJSTest(); | 65 finishJSTest(); |
66 } | 66 } |
67 | 67 |
68 setMockOrientation(null, null, null, false); | 68 setMockOrientation(null, null, null, false); |
69 window.addEventListener('deviceorientation', firstListener); | 69 window.addEventListener('deviceorientation', firstListener); |
70 | 70 |
71 window.jsTestIsAsync = true; | 71 window.jsTestIsAsync = true; |
72 </script> | 72 </script> |
73 </body> | 73 </body> |
74 </html> | 74 </html> |
OLD | NEW |