OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <body> |
| 4 <script src="../resources/js-test.js"></script> |
| 5 <script> |
| 6 description("Validates that consecutive calls to screen.lockOrientation() work a
s expected."); |
| 7 window.jsTestIsAsync = true; |
| 8 |
| 9 var orientationChangeEventCount = 0; |
| 10 function completeTest() { |
| 11 screen.removeEventListener("orientationchange", onOrientationChangeEvent); |
| 12 screen.unlockOrientation(); |
| 13 internals.setScreenOrientation(document, "portrait-primary"); |
| 14 finishJSTest(); |
| 15 } |
| 16 |
| 17 var testEvent; |
| 18 function onOrientationChangeEvent(ev) { |
| 19 ++orientationChangeEventCount; |
| 20 testEvent = ev; |
| 21 debug("Received an 'orientationchange' event."); |
| 22 shouldBe("orientationChangeEventCount", "1"); |
| 23 shouldBeEqualToString("testEvent.type", "orientationchange"); |
| 24 shouldBeEqualToString("screen.orientation", "landscape-primary"); |
| 25 completeTest(); |
| 26 } |
| 27 |
| 28 internals.setScreenOrientationClientMock(document); |
| 29 screen.addEventListener("orientationchange", onOrientationChangeEvent); |
| 30 |
| 31 shouldBeEqualToString("screen.orientation", "portrait-primary"); |
| 32 debug("locking orientation to 'portrait-primary'."); |
| 33 shouldBeTrue("screen.lockOrientation('portrait-primary')"); |
| 34 |
| 35 debug("locking orientation to 'landscape' while locked in 'portrait-primary'."); |
| 36 shouldBeTrue("screen.lockOrientation('landscape')"); |
| 37 </script> |
| 38 </body> |
| 39 </html> |
OLD | NEW |