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

Side by Side Diff: LayoutTests/screen_orientation/exit-fullscreen-unlock-orientation.html

Issue 261983005: Stop firing orientationchange events at pages that are not visible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Simplify test case Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../fullscreen/full-screen-test.js"></script>
5 <script src="../resources/js-test.js"></script>
6 <script>
7 description("Tests that when the document fully exits fullscreen, the orientatio n is locked back to its default value.");
8 window.jsTestIsAsync = true;
9
10 var orientationChangeEventCount = 0;
11 var callback;
12
13 window.addEventListener('orientationchange', function() {
14 orientationChangeEventCount++;
15 });
16
17 function testOrientationChanged() {
18 shouldBe("orientationChangeEventCount", "1");
19 shouldBeEqualToString("screen.orientation", "landscape-primary");
20 finishJSTest();
21 }
22
23 function changeOrientation() {
24 window.testRunner.setMockScreenOrientation('landscape-primary');
25 // We are locked in 'portrait-primary' so we should not get
26 // an orientationchange event.
27 shouldBe("orientationChangeEventCount", "0");
28 shouldBeEqualToString("screen.orientation", "portrait-primary");
29 callback = testOrientationChanged;
30 // Exiting fullscreen mode should reset the screen lock and an orientationch ange
31 // event should be fired since the device is now in 'landscape-primary' and we
32 // we locked in 'portrait-primary'.
33 document.webkitCancelFullScreen();
34 }
35
36 function testLockOrientation() {
37 shouldBeEqualToString("screen.orientation", "portrait-primary");
38 shouldBeTrue("screen.lockOrientation('portrait-primary')");
39 shouldBe("orientationChangeEventCount", "0");
40 setTimeout(changeOrientation, 0);
41 }
42
43 function fullscreenChanged() {
44 if (callback)
45 callback()
46 }
47 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
48 callback = testLockOrientation;
49 runWithKeyDown(function(){document.documentElement.webkitRequestFullScreen()});
50 </script>
51 </body>
52 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698