| Index: LayoutTests/screen_orientation/orientationchange-event-subframe.html
|
| diff --git a/LayoutTests/screen_orientation/orientationchange-event-subframe.html b/LayoutTests/screen_orientation/orientationchange-event-subframe.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f64053f0c4c1ec2702d39b862c7f673abff03213
|
| --- /dev/null
|
| +++ b/LayoutTests/screen_orientation/orientationchange-event-subframe.html
|
| @@ -0,0 +1,46 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<body>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +
|
| +<iframe id="testIframe" sandbox="allow-scripts allow-same-origin" style="display:none">
|
| +</iframe>
|
| +
|
| +<script>
|
| + var test = async_test("Test subframes receive 'orientationchange' events");
|
| +
|
| + var orientations = [
|
| + 'portrait-primary',
|
| + 'portrait-secondary',
|
| + 'landscape-primary',
|
| + 'landscape-secondary'
|
| + ];
|
| +
|
| + var currentIndex = orientations.indexOf(window.screen.orientation);
|
| + var eventsReceived = 0;
|
| +
|
| + function getNextIndex() {
|
| + return (currentIndex + 1) % orientations.length;
|
| + }
|
| +
|
| + function changeOrientation() {
|
| + window.testRunner.setMockScreenOrientation(orientations[getNextIndex()]);
|
| + currentIndex = getNextIndex();
|
| + }
|
| +
|
| + window.onmessage = test.step_func(function (ev) {
|
| + assert_equals(ev.data, orientations[currentIndex], "subframe receives 'orientationchange' event");
|
| + ++eventsReceived;
|
| + if (eventsReceived < 4)
|
| + changeOrientation()
|
| + else
|
| + test.done();
|
| + });
|
| +
|
| + var testIframe = document.getElementById("testIframe");
|
| + testIframe.src = "resources/iframe-listen-orientation-change.html";
|
| + testIframe.onload = changeOrientation;
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|