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

Side by Side Diff: third_party/WebKit/Source/modules/media_controls/MediaControlsRotateToFullscreenDelegateTest.cpp

Issue 2904263002: [Media Controls] Tests for rotate-to-fullscreen meets orientation lock (Closed)
Patch Set: Fix MSVC warning Created 3 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/media_controls/MediaControlsRotateToFullscreenDelegate.h" 5 #include "modules/media_controls/MediaControlsRotateToFullscreenDelegate.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/css/CSSStyleDeclaration.h" 8 #include "core/css/CSSStyleDeclaration.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/Fullscreen.h" 10 #include "core/dom/Fullscreen.h"
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 // n.b. omit to call Fullscreen::From(GetDocument()).DidEnterFullscreen() so 595 // n.b. omit to call Fullscreen::From(GetDocument()).DidEnterFullscreen() so
596 // that MediaControlsOrientationLockDelegate doesn't trigger, which avoids 596 // that MediaControlsOrientationLockDelegate doesn't trigger, which avoids
597 // having to create deviceorientation events here to unlock it again. 597 // having to create deviceorientation events here to unlock it again.
598 testing::RunPendingTasks(); 598 testing::RunPendingTasks();
599 EXPECT_TRUE(GetVideo().IsFullscreen()); 599 EXPECT_TRUE(GetVideo().IsFullscreen());
600 600
601 // Leave video paused (playing is not a requirement to exit fullscreen). 601 // Leave video paused (playing is not a requirement to exit fullscreen).
602 EXPECT_TRUE(GetVideo().paused()); 602 EXPECT_TRUE(GetVideo().paused());
603 EXPECT_FALSE(ObservedVisibility()); 603 EXPECT_FALSE(ObservedVisibility());
604 604
605 // Rotate screen to portrait. This relies on the screen orientation no longer 605 // Rotate screen to portrait. This relies on the screen orientation not being
606 // being locked by MediaControlsOrientationLockDelegate. 606 // locked by MediaControlsOrientationLockDelegate (which has its own tests).
607 RotateTo(kWebScreenOrientationPortraitPrimary); 607 RotateTo(kWebScreenOrientationPortraitPrimary);
608 608
609 // Should exit fullscreen. 609 // Should exit fullscreen.
610 EXPECT_FALSE(GetVideo().IsFullscreen()); 610 EXPECT_FALSE(GetVideo().IsFullscreen());
611 } 611 }
612 612
613 TEST_F(MediaControlsRotateToFullscreenDelegateTest, 613 TEST_F(MediaControlsRotateToFullscreenDelegateTest,
614 ExitSuccessPortraitFullscreenToLandscapeInline) { 614 ExitSuccessPortraitFullscreenToLandscapeInline) {
615 // Portrait screen, portrait video. 615 // Portrait screen, portrait video.
616 InitScreenAndVideo(kWebScreenOrientationPortraitPrimary, WebSize(480, 640)); 616 InitScreenAndVideo(kWebScreenOrientationPortraitPrimary, WebSize(480, 640));
617 EXPECT_EQ(SimpleOrientation::kPortrait, ObservedScreenOrientation()); 617 EXPECT_EQ(SimpleOrientation::kPortrait, ObservedScreenOrientation());
618 EXPECT_EQ(SimpleOrientation::kPortrait, ComputeVideoOrientation()); 618 EXPECT_EQ(SimpleOrientation::kPortrait, ComputeVideoOrientation());
619 619
620 // Start in fullscreen. 620 // Start in fullscreen.
621 { 621 {
622 UserGestureIndicator gesture(UserGestureToken::Create(&GetDocument())); 622 UserGestureIndicator gesture(UserGestureToken::Create(&GetDocument()));
623 GetMediaControls().EnterFullscreen(); 623 GetMediaControls().EnterFullscreen();
624 } 624 }
625 // n.b. omit to call Fullscreen::From(GetDocument()).DidEnterFullscreen() so 625 // n.b. omit to call Fullscreen::From(GetDocument()).DidEnterFullscreen() so
626 // that MediaControlsOrientationLockDelegate doesn't trigger, which avoids 626 // that MediaControlsOrientationLockDelegate doesn't trigger, which avoids
627 // having to create deviceorientation events here to unlock it again. 627 // having to create deviceorientation events here to unlock it again.
628 testing::RunPendingTasks(); 628 testing::RunPendingTasks();
629 EXPECT_TRUE(GetVideo().IsFullscreen()); 629 EXPECT_TRUE(GetVideo().IsFullscreen());
630 630
631 // Leave video paused (playing is not a requirement to exit fullscreen). 631 // Leave video paused (playing is not a requirement to exit fullscreen).
632 EXPECT_TRUE(GetVideo().paused()); 632 EXPECT_TRUE(GetVideo().paused());
633 EXPECT_FALSE(ObservedVisibility()); 633 EXPECT_FALSE(ObservedVisibility());
634 634
635 // Rotate screen to portrait. This relies on the screen orientation no longer 635 // Rotate screen to landscape. This relies on the screen orientation not being
636 // being locked by MediaControlsOrientationLockDelegate. 636 // locked by MediaControlsOrientationLockDelegate (which has its own tests).
637 RotateTo(kWebScreenOrientationLandscapePrimary); 637 RotateTo(kWebScreenOrientationLandscapePrimary);
638 638
639 // Should exit fullscreen. 639 // Should exit fullscreen.
640 EXPECT_FALSE(GetVideo().IsFullscreen()); 640 EXPECT_FALSE(GetVideo().IsFullscreen());
641 } 641 }
642 642
643 TEST_F(MediaControlsRotateToFullscreenDelegateTest, 643 TEST_F(MediaControlsRotateToFullscreenDelegateTest,
644 ExitFailDocumentFullscreen) { 644 ExitFailDocumentFullscreen) {
645 // Landscape screen, landscape video. 645 // Landscape screen, landscape video.
646 InitScreenAndVideo(kWebScreenOrientationLandscapePrimary, WebSize(640, 480)); 646 InitScreenAndVideo(kWebScreenOrientationLandscapePrimary, WebSize(640, 480));
(...skipping 16 matching lines...) Expand all
663 663
664 // Rotate screen to portrait. 664 // Rotate screen to portrait.
665 RotateTo(kWebScreenOrientationPortraitPrimary); 665 RotateTo(kWebScreenOrientationPortraitPrimary);
666 666
667 // Should not exit fullscreen, since video was not the fullscreen element. 667 // Should not exit fullscreen, since video was not the fullscreen element.
668 EXPECT_TRUE(Fullscreen::IsCurrentFullScreenElement(*GetDocument().body())); 668 EXPECT_TRUE(Fullscreen::IsCurrentFullScreenElement(*GetDocument().body()));
669 EXPECT_FALSE(GetVideo().IsFullscreen()); 669 EXPECT_FALSE(GetVideo().IsFullscreen());
670 } 670 }
671 671
672 } // namespace blink 672 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698