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

Side by Side Diff: LayoutTests/screen_orientation/page-visibility.html

Issue 319633007: Move WebScreenOrientationClient to WebFrameClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: m_client null check Created 6 years, 6 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
« no previous file with comments | « no previous file | Source/modules/screen_orientation/ScreenOrientation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <iframe src='about:blank'></iframe>
6 <script> 7 <script>
7 var orientationChangeEventListenerCalls = 0; 8 var orientationChangeEventListenerCalls = 0;
9 var orientationChangeEventListenerCallsForFrame = 0;
8 10
9 window.addEventListener('orientationchange', function() { 11 window.addEventListener('orientationchange', function() {
10 orientationChangeEventListenerCalls++; 12 orientationChangeEventListenerCalls++;
11 }); 13 });
12 14
15 window.frames[0].addEventListener('orientationchange', function() {
16 orientationChangeEventListenerCallsForFrame++;
17 });
18
13 test(function() { 19 test(function() {
14 assert_false(document.hidden); 20 assert_false(document.hidden);
15 if (window.testRunner) 21 if (window.testRunner)
16 window.testRunner.setMockScreenOrientation("landscape-primary"); 22 window.testRunner.setMockScreenOrientation("landscape-primary");
17 assert_equals(orientationChangeEventListenerCalls, 1); 23 assert_equals(orientationChangeEventListenerCalls, 1);
18 assert_equals(screen.orientation, "landscape-primary"); 24 assert_equals(screen.orientation, "landscape-primary");
19 }, "Test that 'orientationchange' event is fired when the page is visible"); 25 }, "Test that 'orientationchange' event is fired when the page is visible");
20 26
21 if (window.testRunner) 27 if (window.testRunner)
22 testRunner.setPageVisibility("hidden"); 28 testRunner.setPageVisibility("hidden");
(...skipping 12 matching lines...) Expand all
35 if (window.testRunner) 41 if (window.testRunner)
36 testRunner.setPageVisibility("visible"); 42 testRunner.setPageVisibility("visible");
37 43
38 test(function() { 44 test(function() {
39 assert_false(document.hidden); 45 assert_false(document.hidden);
40 // An 'orientationchange' event should have been fired. 46 // An 'orientationchange' event should have been fired.
41 assert_equals(orientationChangeEventListenerCalls, 2); 47 assert_equals(orientationChangeEventListenerCalls, 2);
42 // Should keep returning the start returning the orientation value. 48 // Should keep returning the start returning the orientation value.
43 assert_equals(screen.orientation, "portrait-primary"); 49 assert_equals(screen.orientation, "portrait-primary");
44 }, "Test that screen.orientation is updated once the page is visible again"); 50 }, "Test that screen.orientation is updated once the page is visible again");
51
52 test(function() {
53 assert_equals(orientationChangeEventListenerCallsForFrame, orientationChange EventListenerCalls);
54 }, "Test that the iframe got as many events as the main frame.")
55
45 </script> 56 </script>
46 </body> 57 </body>
47 </html> 58 </html>
OLDNEW
« no previous file with comments | « no previous file | Source/modules/screen_orientation/ScreenOrientation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698