| Index: LayoutTests/screen_orientation/consecutive-locking.html
|
| diff --git a/LayoutTests/screen_orientation/consecutive-locking.html b/LayoutTests/screen_orientation/consecutive-locking.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b21fe6cc4707bd0ff3931053376db95d7a574cb6
|
| --- /dev/null
|
| +++ b/LayoutTests/screen_orientation/consecutive-locking.html
|
| @@ -0,0 +1,39 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<body>
|
| +<script src="../resources/js-test.js"></script>
|
| +<script>
|
| +description("Validates that consecutive calls to screen.lockOrientation() work as expected.");
|
| +window.jsTestIsAsync = true;
|
| +
|
| +var orientationChangeEventCount = 0;
|
| +function completeTest() {
|
| + screen.removeEventListener("orientationchange", onOrientationChangeEvent);
|
| + screen.unlockOrientation();
|
| + internals.setScreenOrientation(document, "portrait-primary");
|
| + finishJSTest();
|
| +}
|
| +
|
| +var testEvent;
|
| +function onOrientationChangeEvent(ev) {
|
| + ++orientationChangeEventCount;
|
| + testEvent = ev;
|
| + debug("Received an 'orientationchange' event.");
|
| + shouldBe("orientationChangeEventCount", "1");
|
| + shouldBeEqualToString("testEvent.type", "orientationchange");
|
| + shouldBeEqualToString("screen.orientation", "landscape-primary");
|
| + completeTest();
|
| +}
|
| +
|
| +internals.setScreenOrientationClientMock(document);
|
| +screen.addEventListener("orientationchange", onOrientationChangeEvent);
|
| +
|
| +shouldBeEqualToString("screen.orientation", "portrait-primary");
|
| +debug("locking orientation to 'portrait-primary'.");
|
| +shouldBeTrue("screen.lockOrientation('portrait-primary')");
|
| +
|
| +debug("locking orientation to 'landscape' while locked in 'portrait-primary'.");
|
| +shouldBeTrue("screen.lockOrientation('landscape')");
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|