| Index: LayoutTests/screen_orientation/locking-fires-event.html | 
| diff --git a/LayoutTests/screen_orientation/locking-fires-event.html b/LayoutTests/screen_orientation/locking-fires-event.html | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..e0a549a08de1e4f8cd236da9a4b134ec3ec37844 | 
| --- /dev/null | 
| +++ b/LayoutTests/screen_orientation/locking-fires-event.html | 
| @@ -0,0 +1,38 @@ | 
| +<!DOCTYPE html> | 
| +<html> | 
| +<body> | 
| +<script src="../resources/js-test.js"></script> | 
| +<script> | 
| +description("Validates that screen.lockOrientation() fires an event if the orientation had to be changed to meet the locking requirements."); | 
| +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 'landscape-primary'."); | 
| +shouldBeTrue("screen.lockOrientation('landscape-primary')"); | 
| +// Locking should be asynchronous. | 
| +shouldBeEqualToString("screen.orientation", "portrait-primary"); | 
| +</script> | 
| +</body> | 
| +</html> | 
|  |