Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / screen_orientation / window-orientationchange-event-subframe.html
blob3be5a286fff9c0e7f596baeba8407f5cdc903827
1 <!DOCTYPE html>
2 <html>
3 <body>
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">
8 </iframe>
10 <script>
11 var test = async_test("Test subframes receive window orientationchange events (includes window.onorientationchange and an event listener for orientationchange)");
13 if (window.internals && internals.runtimeFlags.orientationEventEnabled) {
14 var orientations = [
15 'portrait-primary',
16 'portrait-secondary',
17 'landscape-primary',
18 'landscape-secondary'
21 var orientationAngles = [
23 180,
24 90,
25 -90
28 var currentIndex = 0;
29 var eventsReceived = 0;
30 var numOrientationChanges = 0;
32 function getNextIndex() {
33 return (currentIndex + 1) % orientations.length;
36 function changeOrientation() {
37 window.testRunner.setMockScreenOrientation(orientations[getNextIndex()]);
38 currentIndex = getNextIndex();
39 ++numOrientationChanges;
42 window.onmessage = test.step_func(function (ev) {
43 assert_equals(ev.data, orientationAngles[currentIndex], "subframe received orientationchange event (window.screen.orientation.type=" + window.screen.orientation.type + ")");
44 ++eventsReceived;
46 // Once *both* of the event handlers/listeners have seen this event,
47 // change the orientation or end the test.
48 if ((eventsReceived % 2) == 0) {
49 assert_equals(eventsReceived, numOrientationChanges*2);
51 if (numOrientationChanges < 4) {
52 changeOrientation();
53 } else if (numOrientationChanges == 4) {
54 test.done();
57 });
59 var testIframe = document.getElementById("testIframe");
60 testIframe.src = "resources/iframe-listen-window-orientationchange.html";
61 testIframe.onload = changeOrientation;
62 } else {
63 console.error("This test requires window.internals and the orientationchange event to be enabled.");
64 test.done();
66 </script>
67 </body>
68 </html>