| Index: LayoutTests/screen_orientation/lockOrientation-array-argument.html
|
| diff --git a/LayoutTests/screen_orientation/lockOrientation-array-argument.html b/LayoutTests/screen_orientation/lockOrientation-array-argument.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8e4976285e1a0a7a1d75beb9f1ab046fca3d977d
|
| --- /dev/null
|
| +++ b/LayoutTests/screen_orientation/lockOrientation-array-argument.html
|
| @@ -0,0 +1,59 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<body>
|
| +<script src="../resources/js-test.js"></script>
|
| +<script>
|
| +description("Validates that lockOrientation() can take an array as argument.");
|
| +window.jsTestIsAsync = true;
|
| +
|
| +var orientationChangeCount = 0;
|
| +var currentTestOrientation = 0;
|
| +var testOrientations = [
|
| + "portrait-secondary",
|
| + "landscape-primary",
|
| + "landscape-secondary",
|
| + "portrait-primary"
|
| +];
|
| +
|
| +function testComplete() {
|
| + screen.unlockOrientation();
|
| + finishJSTest();
|
| +}
|
| +
|
| +var testEvent;
|
| +function onOrientationChangeEvent(ev) {
|
| + ++orientationChangeCount;
|
| + testEvent = ev;
|
| + if (screen.orientation != "portrait-primary" && screen.orientation != "landscape-primary") {
|
| + ++orientationChangeCount;
|
| + testFailed("Unexpected 'orientationchange' event for " + screen.orientation);
|
| + testComplete();
|
| + }
|
| + testPassed("Received an 'orientationchange' event.");
|
| + shouldBeEqualToString("testEvent.type", "orientationchange");
|
| + if (orientationChangeCount == 1) {
|
| + shouldBeEqualToString("screen.orientation", "landscape-primary");
|
| + } else {
|
| + shouldBe("orientationChangeCount", "2");
|
| + shouldBeEqualToString("screen.orientation", "portrait-primary");
|
| + testComplete();
|
| + }
|
| +}
|
| +
|
| +function changeOrientation() {
|
| + internals.setScreenOrientation(document, testOrientations[currentTestOrientation++]);
|
| + if (currentTestOrientation < testOrientations.length)
|
| + setTimeout(changeOrientation, 100);
|
| +}
|
| +
|
| +internals.setScreenOrientationClientMock(document);
|
| +screen.addEventListener("orientationchange", onOrientationChangeEvent);
|
| +
|
| +shouldBeEqualToString("screen.orientation", "portrait-primary");
|
| +
|
| +debug("locking orientation to ['portrait-primary', 'landscape-primary'].");
|
| +shouldBeTrue("screen.lockOrientation(['portrait-primary', 'landscape-primary'])");
|
| +setTimeout(changeOrientation, 100);
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|