Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1180)

Side by Side Diff: LayoutTests/screen_orientation/orientationchange-event-subframe.html

Issue 381753002: Revert of [screen-orientation] Update implementation to match recent spec changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <script src="../resources/testharness.js"></script> 4 <script src="../resources/testharness.js"></script>
5 <script src="../resources/testharnessreport.js"></script> 5 <script src="../resources/testharnessreport.js"></script>
6 6
7 <iframe id="testIframe" sandbox="allow-scripts allow-same-origin" style="display :none"> 7 <iframe id="testIframe" sandbox="allow-scripts allow-same-origin" style="display :none">
8 </iframe> 8 </iframe>
9 9
10 <script> 10 <script>
11 var test = async_test("Test subframes receive orientation change events"); 11 var test = async_test("Test subframes receive 'orientationchange' events");
12 12
13 var orientations = [ 13 var orientations = [
14 'portrait-primary', 14 'portrait-primary',
15 'portrait-secondary', 15 'portrait-secondary',
16 'landscape-primary', 16 'landscape-primary',
17 'landscape-secondary' 17 'landscape-secondary'
18 ]; 18 ];
19 19
20 var currentIndex = orientations.indexOf(window.screen.orientation.type); 20 var currentIndex = orientations.indexOf(window.screen.orientation);
21 var eventsReceived = 0; 21 var eventsReceived = 0;
22 22
23 function getNextIndex() { 23 function getNextIndex() {
24 return (currentIndex + 1) % orientations.length; 24 return (currentIndex + 1) % orientations.length;
25 } 25 }
26 26
27 function changeOrientation() { 27 function changeOrientation() {
28 window.testRunner.setMockScreenOrientation(orientations[getNextIndex()]) ; 28 window.testRunner.setMockScreenOrientation(orientations[getNextIndex()]) ;
29 currentIndex = getNextIndex(); 29 currentIndex = getNextIndex();
30 } 30 }
31 31
32 window.onmessage = test.step_func(function (ev) { 32 window.onmessage = test.step_func(function (ev) {
33 assert_equals(ev.data, orientations[currentIndex], "subframe receives or ientation change event"); 33 assert_equals(ev.data, orientations[currentIndex], "subframe receives 'o rientationchange' event");
34 ++eventsReceived; 34 ++eventsReceived;
35 if (eventsReceived < 4) 35 if (eventsReceived < 4)
36 changeOrientation() 36 changeOrientation()
37 else 37 else
38 test.done(); 38 test.done();
39 }); 39 });
40 40
41 var testIframe = document.getElementById("testIframe"); 41 var testIframe = document.getElementById("testIframe");
42 testIframe.src = "resources/iframe-listen-orientation-change.html"; 42 testIframe.src = "resources/iframe-listen-orientation-change.html";
43 testIframe.onload = changeOrientation; 43 testIframe.onload = changeOrientation;
44 </script> 44 </script>
45 </body> 45 </body>
46 </html> 46 </html>
OLDNEW
« no previous file with comments | « LayoutTests/screen_orientation/orientationchange-event.html ('k') | LayoutTests/screen_orientation/page-visibility.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698