| Index: LayoutTests/screen_orientation/locked-no-orientation-change-event.html
|
| diff --git a/LayoutTests/screen_orientation/locked-no-orientation-change-event.html b/LayoutTests/screen_orientation/locked-no-orientation-change-event.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d0a284c424777fac9a05142fcdf052c4d5b164eb
|
| --- /dev/null
|
| +++ b/LayoutTests/screen_orientation/locked-no-orientation-change-event.html
|
| @@ -0,0 +1,52 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<body>
|
| +<script src="../resources/js-test.js"></script>
|
| +<script>
|
| +description("Validates that no orientationchange event is fired when we are locked.");
|
| +window.jsTestIsAsync = true;
|
| +
|
| +var orientationChangeCount = 0;
|
| +var currentTestOrientation = 0;
|
| +var testOrientations = [
|
| + "portrait-secondary",
|
| + "landscape-primary",
|
| + "landscape-secondary",
|
| + "portrait-primary"
|
| +];
|
| +
|
| +function testComplete() {
|
| + screen.unlockOrientation();
|
| + finishJSTest();
|
| +}
|
| +
|
| +function onOrientationChangeEvent(ev) {
|
| + ++orientationChangeCount;
|
| + testFailed("Unexpected 'orientationchange' event.");
|
| +}
|
| +
|
| +function changeOrientation() {
|
| + shouldBeEqualToString("screen.orientation", "portrait-primary");
|
| + if (currentTestOrientation == testOrientations.length) {
|
| + if (orientationChangeCount)
|
| + testFailed("Received " + orientationChangeCount + " unexpected 'orientationchange' event(s).");
|
| + else
|
| + testPassed("Received no 'orientationchange' event, as expected.");
|
| + testComplete();
|
| + return;
|
| + }
|
| + debug("Faking device screen orientation change to '" + testOrientations[currentTestOrientation] +"'...");
|
| + internals.setScreenOrientation(document, testOrientations[currentTestOrientation++]);
|
| + setTimeout(changeOrientation, 0);
|
| +}
|
| +
|
| +internals.setScreenOrientationClientMock(document);
|
| +screen.addEventListener("orientationchange", onOrientationChangeEvent);
|
| +
|
| +shouldBeEqualToString("screen.orientation", "portrait-primary");
|
| +debug("locking orientation to 'portrait-primary'.");
|
| +shouldBeTrue("screen.lockOrientation('portrait-primary')");
|
| +setTimeout(changeOrientation, 0);
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|