Index: LayoutTests/screen_orientation/orientation-change-event.html |
diff --git a/LayoutTests/screen_orientation/orientation-change-event.html b/LayoutTests/screen_orientation/orientation-change-event.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0aae94af086d881e86cc9628bc2ab2aac8fccb99 |
--- /dev/null |
+++ b/LayoutTests/screen_orientation/orientation-change-event.html |
@@ -0,0 +1,36 @@ |
+<!DOCTYPE html> |
+<html> |
+<body> |
+<script src="../resources/js-test.js"></script> |
+<script> |
+description("Validates that the orientationchange event is fired."); |
+window.jsTestIsAsync = true; |
+ |
+var currentTestOrientation = 0; |
+var testOrientations = [ |
+ "portrait-secondary", |
+ "landscape-primary", |
+ "landscape-secondary", |
+ "portrait-primary" |
+]; |
+ |
+var testEvent; |
+function onOrientationChangeEvent(ev) { |
+ testEvent = ev; |
+ shouldBeEqualToString("testEvent.type", "orientationchange"); |
+ shouldBeEqualToString("screen.orientation", "" + testOrientations[currentTestOrientation]); |
+ if (currentTestOrientation == testOrientations.length - 1) { |
+ finishJSTest(); |
+ return; |
+ } |
+ internals.setScreenOrientation(document, testOrientations[++currentTestOrientation]); |
+} |
+ |
+shouldBeEqualToString("screen.orientation", "portrait-primary"); |
+ |
+internals.setScreenOrientationClientMock(document); |
+screen.addEventListener("orientationchange", onOrientationChangeEvent); |
+internals.setScreenOrientation(document, testOrientations[currentTestOrientation]); |
+</script> |
+</body> |
+</html> |