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("Validates that screen.lockOrientation() returns false on bad input"
); | 6 description("Validates that screen.lockOrientation() returns false on bad input"
); |
7 window.jsTestIsAsync = true; | 7 window.jsTestIsAsync = true; |
8 | 8 |
9 function onOrientationChangeEvent(ev) { | 9 function onOrientationChangeEvent(ev) { |
10 testFailed("Unexpected 'orientationchange' event"); | 10 testFailed("Unexpected 'orientationchange' event"); |
11 } | 11 } |
12 | 12 |
13 function completeTest() { | 13 function completeTest() { |
14 shouldBeEqualToString("screen.orientation", "portrait-primary"); | 14 shouldBeEqualToString("screen.orientation", "portrait-primary"); |
15 screen.unlockOrientation(); | 15 screen.unlockOrientation(); |
16 finishJSTest(); | 16 finishJSTest(); |
17 } | 17 } |
18 | 18 |
19 screen.addEventListener("orientationchange", onOrientationChangeEvent); | 19 screen.addEventListener("orientationchange", onOrientationChangeEvent); |
20 | 20 |
21 shouldBeEqualToString("screen.orientation", "portrait-primary"); | 21 shouldBeEqualToString("screen.orientation", "portrait-primary"); |
22 shouldBeFalse("screen.lockOrientation('invalid-orientation')"); | 22 shouldBeFalse("screen.lockOrientation('invalid-orientation')"); |
23 shouldBeEqualToString("screen.orientation", "portrait-primary"); | 23 shouldBeEqualToString("screen.orientation", "portrait-primary"); |
24 shouldBeFalse("screen.lockOrientation(null)"); | 24 shouldBeFalse("screen.lockOrientation(null)"); |
25 shouldBeEqualToString("screen.orientation", "portrait-primary"); | 25 shouldBeEqualToString("screen.orientation", "portrait-primary"); |
26 shouldBeFalse("screen.lockOrientation(undefined)"); | 26 shouldBeFalse("screen.lockOrientation(undefined)"); |
27 shouldBeEqualToString("screen.orientation", "portrait-primary"); | 27 shouldBeEqualToString("screen.orientation", "portrait-primary"); |
28 shouldBeFalse("screen.lockOrientation(123)"); | 28 shouldBeFalse("screen.lockOrientation(123)"); |
29 shouldBeEqualToString("screen.orientation", "portrait-primary"); | 29 shouldBeEqualToString("screen.orientation", "portrait-primary"); |
30 shouldBeFalse("screen.lockOrientation(window)"); | 30 shouldBeFalse("screen.lockOrientation(window)"); |
31 shouldBeEqualToString("screen.orientation", "portrait-primary"); | 31 shouldBeEqualToString("screen.orientation", "portrait-primary"); |
| 32 shouldBeFalse("screen.lockOrientation(['portrait-primary', 'landscape-primary'])
"); |
| 33 shouldBeEqualToString("screen.orientation", "portrait-primary"); |
32 shouldThrow("screen.lockOrientation()", '"TypeError: Failed to execute \'lockOri
entation\' on \'Screen\': 1 argument required, but only 0 present."'); | 34 shouldThrow("screen.lockOrientation()", '"TypeError: Failed to execute \'lockOri
entation\' on \'Screen\': 1 argument required, but only 0 present."'); |
33 | 35 |
34 // Finish asynchronously to give events a chance to fire. | 36 // Finish asynchronously to give events a chance to fire. |
35 setTimeout(completeTest, 0); | 37 setTimeout(completeTest, 0); |
36 </script> | 38 </script> |
37 </body> | 39 </body> |
38 </html> | 40 </html> |
39 | 41 |
OLD | NEW |