4 <script src=
"../resources/testharness.js"></script>
5 <script src=
"../resources/testharnessreport.js"></script>
7 <iframe id=
"testIframe" sandbox=
"allow-scripts allow-same-origin" style=
"display:none">
11 var test
= async_test("Test subframes receive orientation change events");
20 var currentIndex
= orientations
.indexOf(window
.screen
.orientation
.type
);
21 var eventsReceived
= 0;
23 function getNextIndex() {
24 return (currentIndex
+ 1) % orientations
.length
;
27 function changeOrientation() {
28 window
.testRunner
.setMockScreenOrientation(orientations
[getNextIndex()]);
29 currentIndex
= getNextIndex();
32 window
.onmessage
= test
.step_func(function (ev
) {
33 assert_equals(ev
.data
, orientations
[currentIndex
], "subframe receives orientation change event");
35 if (eventsReceived
< 4)
41 var testIframe
= document
.getElementById("testIframe");
42 testIframe
.src
= "resources/iframe-listen-orientation-change.html";
43 testIframe
.onload
= changeOrientation
;