| Index: LayoutTests/screen_orientation/exit-fullscreen-unlock-orientation.html
|
| diff --git a/LayoutTests/screen_orientation/exit-fullscreen-unlock-orientation.html b/LayoutTests/screen_orientation/exit-fullscreen-unlock-orientation.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1d3c021fc833d25f8e0034e6970662e7b201630f
|
| --- /dev/null
|
| +++ b/LayoutTests/screen_orientation/exit-fullscreen-unlock-orientation.html
|
| @@ -0,0 +1,52 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<body>
|
| +<script src="../fullscreen/full-screen-test.js"></script>
|
| +<script src="../resources/js-test.js"></script>
|
| +<script>
|
| +description("Tests that when the document fully exits fullscreen, the orientation is locked back to its default value.");
|
| +window.jsTestIsAsync = true;
|
| +
|
| +var orientationChangeEventCount = 0;
|
| +var callback;
|
| +
|
| +window.addEventListener('orientationchange', function() {
|
| + orientationChangeEventCount++;
|
| +});
|
| +
|
| +function testOrientationChanged() {
|
| + shouldBe("orientationChangeEventCount", "1");
|
| + shouldBeEqualToString("screen.orientation", "landscape-primary");
|
| + finishJSTest();
|
| +}
|
| +
|
| +function changeOrientation() {
|
| + window.testRunner.setMockScreenOrientation('landscape-primary');
|
| + // We are locked in 'portrait-primary' so we should not get
|
| + // an orientationchange event.
|
| + shouldBe("orientationChangeEventCount", "0");
|
| + shouldBeEqualToString("screen.orientation", "portrait-primary");
|
| + callback = testOrientationChanged;
|
| + // Exiting fullscreen mode should reset the screen lock and an orientationchange
|
| + // event should be fired since the device is now in 'landscape-primary' and we
|
| + // we locked in 'portrait-primary'.
|
| + document.webkitCancelFullScreen();
|
| +}
|
| +
|
| +function testLockOrientation() {
|
| + shouldBeEqualToString("screen.orientation", "portrait-primary");
|
| + shouldBeTrue("screen.lockOrientation('portrait-primary')");
|
| + shouldBe("orientationChangeEventCount", "0");
|
| + setTimeout(changeOrientation, 0);
|
| +}
|
| +
|
| +function fullscreenChanged() {
|
| + if (callback)
|
| + callback()
|
| +}
|
| +waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
|
| +callback = testLockOrientation;
|
| +runWithKeyDown(function(){document.documentElement.webkitRequestFullScreen()});
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|