| Index: LayoutTests/screen_orientation/multiple-orientations-locking.html | 
| diff --git a/LayoutTests/screen_orientation/multiple-orientations-locking.html b/LayoutTests/screen_orientation/multiple-orientations-locking.html | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..5cb3336e0aa3c5c347b23195b603582779615149 | 
| --- /dev/null | 
| +++ b/LayoutTests/screen_orientation/multiple-orientations-locking.html | 
| @@ -0,0 +1,58 @@ | 
| +<!DOCTYPE html> | 
| +<html> | 
| +<body> | 
| +<script src="../resources/js-test.js"></script> | 
| +<script> | 
| +description("Validates that orientationchange events can fired when several orientations 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(); | 
| +} | 
| + | 
| +var testEvent; | 
| +function onOrientationChangeEvent(ev) { | 
| +    ++orientationChangeCount; | 
| +    testEvent = ev; | 
| +    if (screen.orientation != "portrait-primary" && screen.orientation != "portrait-secondary") { | 
| +        ++orientationChangeCount; | 
| +        testFailed("Unexpected 'orientationchange' event for " + screen.orientation); | 
| +        testComplete(); | 
| +    } | 
| +    testPassed("Received an 'orientationchange' event."); | 
| +    shouldBeEqualToString("testEvent.type", "orientationchange"); | 
| +    if (orientationChangeCount == 1) { | 
| +    	shouldBeEqualToString("screen.orientation", "portrait-secondary"); | 
| +    } else { | 
| +        shouldBe("orientationChangeCount", "2"); | 
| +        shouldBeEqualToString("screen.orientation", "portrait-primary"); | 
| +        testComplete(); | 
| +    } | 
| +} | 
| + | 
| +function changeOrientation() { | 
| +    internals.setScreenOrientation(document, testOrientations[currentTestOrientation++]); | 
| +    if (currentTestOrientation < testOrientations.length) | 
| +        setTimeout(changeOrientation, 0); | 
| +} | 
| + | 
| +internals.setScreenOrientationClientMock(document); | 
| +screen.addEventListener("orientationchange", onOrientationChangeEvent); | 
| + | 
| +shouldBeEqualToString("screen.orientation", "portrait-primary"); | 
| +debug("locking orientation to 'portrait'."); | 
| +shouldBeTrue("screen.lockOrientation('portrait')"); | 
| +setTimeout(changeOrientation, 0); | 
| +</script> | 
| +</body> | 
| +</html> | 
|  |