OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <body> | |
4 <script src="../resources/js-test.js"></script> | |
5 <script> | |
6 description("Validates that lockOrientation() can take an array in argument."); | |
7 window.jsTestIsAsync = true; | |
8 | |
9 var orientationChangeCount = 0; | |
10 var currentTestOrientation = 0; | |
11 var testOrientations = [ | |
12 "portrait-secondary", | |
13 "landscape-primary", | |
14 "landscape-secondary", | |
15 "portrait-primary" | |
16 ]; | |
17 | |
18 function testComplete() { | |
19 screen.unlockOrientation(); | |
20 internals.setScreenOrientation(document, "portrait-primary"); | |
21 finishJSTest(); | |
22 } | |
23 | |
24 var testEvent; | |
25 function onOrientationChangeEvent(ev) { | |
26 ++orientationChangeCount; | |
27 testEvent = ev; | |
28 | |
29 testPassed("Received an 'orientationchange' event."); | |
30 shouldBeEqualToString("testEvent.type", "orientationchange"); | |
31 shouldBe("orientationChangeCount", "1"); | |
32 shouldBeEqualToString("screen.orientation", "landscape-primary"); | |
33 testComplete(); | |
34 } | |
35 | |
36 function changeOrientation() { | |
37 internals.setScreenOrientation(document, testOrientations[currentTestOrienta tion++]); | |
38 if (currentTestOrientation < testOrientations.length) | |
39 setTimeout(changeOrientation, 100); | |
40 } | |
41 | |
42 internals.setScreenOrientationClientMock(document); | |
43 screen.addEventListener("orientationchange", onOrientationChangeEvent); | |
44 | |
45 shouldBeEqualToString("screen.orientation", "portrait-primary"); | |
46 // Bad argument to lockOrientation(), we should not get locked. | |
47 shouldBeFalse("screen.lockOrientation(['portrait-primary', 'invalid-orientation' ])"); | |
mlamouri (slow - plz ping)
2014/02/12 20:11:26
Maybe you could test that false is returned with d
Inactive
2014/02/12 21:08:04
Done.
| |
48 debug("Faking device screen orientation change to 'landscape-primary'..."); | |
49 internals.setScreenOrientation(document, "landscape-primary"); | |
50 </script> | |
51 </body> | |
52 </html> | |
OLD | NEW |