Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <body> | |
| 4 <script src="../resources/testharness.js"></script> | |
| 5 <script src="../resources/testharnessreport.js"></script> | |
| 6 <script> | |
| 7 var orientationChangeEventListenerCalls = 0; | |
| 8 | |
| 9 window.addEventListener('orientationchange', function() { | |
| 10 orientationChangeEventListenerCalls++; | |
| 11 }); | |
| 12 | |
| 13 test(function() { | |
| 14 assert_false(document.hidden); | |
| 15 if (window.testRunner) | |
| 16 window.testRunner.setMockScreenOrientation("landscape-primary"); | |
| 17 assert_equals(orientationChangeEventListenerCalls, 1); | |
| 18 assert_equals(screen.orientation, "landscape-primary"); | |
| 19 }, "Test that 'orientationchange' event is fired when the page is visible"); | |
| 20 | |
| 21 if (window.testRunner) | |
| 22 testRunner.setPageVisibility("hidden"); | |
| 23 | |
| 24 test(function() { | |
| 25 assert_true(document.hidden); | |
| 26 if (window.testRunner) | |
| 27 window.testRunner.setMockScreenOrientation("portrait-primary"); | |
| 28 assert_equals(orientationChangeEventListenerCalls, 1); | |
| 29 }, "Test that 'orientationchange' event is not fired when the page is not visibl e"); | |
| 30 | |
| 31 test(function() { | |
| 32 assert_equals(screen.orientation, "landscape-primary"); | |
| 33 }, "Test that screen.orientation keeps returning the same orientation when the p age is not visible"); | |
| 34 | |
| 35 if (window.testRunner) | |
| 36 testRunner.setPageVisibility("visible"); | |
| 37 | |
| 38 test(function() { | |
| 39 assert_false(document.hidden); | |
| 40 // Should keep returning the start returning the orientation value. | |
| 41 assert_equals(screen.orientation, "portrait-primary"); | |
|
mlamouri (slow - plz ping)
2014/05/28 14:05:33
We should test that an event has been fired too.
Inactive
2014/05/28 15:27:28
Done.
| |
| 42 }, "Test that screen.orientation is updated once the page is visible again"); | |
| 43 </script> | |
| 44 </body> | |
| 45 </html> | |
| OLD | NEW |