| OLD | NEW |
| 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 EXPECT_EQ(SimpleOrientation::kPortrait, ObservedScreenOrientation()); | 556 EXPECT_EQ(SimpleOrientation::kPortrait, ObservedScreenOrientation()); |
| 557 EXPECT_EQ(SimpleOrientation::kLandscape, ComputeVideoOrientation()); | 557 EXPECT_EQ(SimpleOrientation::kLandscape, ComputeVideoOrientation()); |
| 558 | 558 |
| 559 // Simulate the webpage requesting fullscreen on some other element than the | 559 // Simulate the webpage requesting fullscreen on some other element than the |
| 560 // video (in this case document.body). | 560 // video (in this case document.body). |
| 561 { | 561 { |
| 562 UserGestureIndicator gesture(UserGestureToken::Create(&GetDocument())); | 562 UserGestureIndicator gesture(UserGestureToken::Create(&GetDocument())); |
| 563 Fullscreen::RequestFullscreen(*GetDocument().body()); | 563 Fullscreen::RequestFullscreen(*GetDocument().body()); |
| 564 } | 564 } |
| 565 testing::RunPendingTasks(); | 565 testing::RunPendingTasks(); |
| 566 EXPECT_TRUE(Fullscreen::IsCurrentFullScreenElement(*GetDocument().body())); | 566 EXPECT_TRUE(Fullscreen::IsFullscreenElement(*GetDocument().body())); |
| 567 EXPECT_FALSE(GetVideo().IsFullscreen()); | 567 EXPECT_FALSE(GetVideo().IsFullscreen()); |
| 568 | 568 |
| 569 // Play video. | 569 // Play video. |
| 570 PlayVideo(); | 570 PlayVideo(); |
| 571 UpdateVisibilityObserver(); | 571 UpdateVisibilityObserver(); |
| 572 | 572 |
| 573 EXPECT_TRUE(ObservedVisibility()); | 573 EXPECT_TRUE(ObservedVisibility()); |
| 574 | 574 |
| 575 // Rotate screen to landscape. | 575 // Rotate screen to landscape. |
| 576 RotateTo(kWebScreenOrientationLandscapePrimary); | 576 RotateTo(kWebScreenOrientationLandscapePrimary); |
| 577 | 577 |
| 578 // Should not enter fullscreen on video, since document is already fullscreen. | 578 // Should not enter fullscreen on video, since document is already fullscreen. |
| 579 EXPECT_TRUE(Fullscreen::IsCurrentFullScreenElement(*GetDocument().body())); | 579 EXPECT_TRUE(Fullscreen::IsFullscreenElement(*GetDocument().body())); |
| 580 EXPECT_FALSE(GetVideo().IsFullscreen()); | 580 EXPECT_FALSE(GetVideo().IsFullscreen()); |
| 581 } | 581 } |
| 582 | 582 |
| 583 TEST_F(MediaControlsRotateToFullscreenDelegateTest, | 583 TEST_F(MediaControlsRotateToFullscreenDelegateTest, |
| 584 ExitSuccessLandscapeFullscreenToPortraitInline) { | 584 ExitSuccessLandscapeFullscreenToPortraitInline) { |
| 585 // Landscape screen, landscape video. | 585 // Landscape screen, landscape video. |
| 586 InitScreenAndVideo(kWebScreenOrientationLandscapePrimary, WebSize(640, 480)); | 586 InitScreenAndVideo(kWebScreenOrientationLandscapePrimary, WebSize(640, 480)); |
| 587 EXPECT_EQ(SimpleOrientation::kLandscape, ObservedScreenOrientation()); | 587 EXPECT_EQ(SimpleOrientation::kLandscape, ObservedScreenOrientation()); |
| 588 EXPECT_EQ(SimpleOrientation::kLandscape, ComputeVideoOrientation()); | 588 EXPECT_EQ(SimpleOrientation::kLandscape, ComputeVideoOrientation()); |
| 589 | 589 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 EXPECT_EQ(SimpleOrientation::kLandscape, ObservedScreenOrientation()); | 647 EXPECT_EQ(SimpleOrientation::kLandscape, ObservedScreenOrientation()); |
| 648 EXPECT_EQ(SimpleOrientation::kLandscape, ComputeVideoOrientation()); | 648 EXPECT_EQ(SimpleOrientation::kLandscape, ComputeVideoOrientation()); |
| 649 | 649 |
| 650 // Simulate the webpage requesting fullscreen on some other element than the | 650 // Simulate the webpage requesting fullscreen on some other element than the |
| 651 // video (in this case document.body). | 651 // video (in this case document.body). |
| 652 { | 652 { |
| 653 UserGestureIndicator gesture(UserGestureToken::Create(&GetDocument())); | 653 UserGestureIndicator gesture(UserGestureToken::Create(&GetDocument())); |
| 654 Fullscreen::RequestFullscreen(*GetDocument().body()); | 654 Fullscreen::RequestFullscreen(*GetDocument().body()); |
| 655 } | 655 } |
| 656 testing::RunPendingTasks(); | 656 testing::RunPendingTasks(); |
| 657 EXPECT_TRUE(Fullscreen::IsCurrentFullScreenElement(*GetDocument().body())); | 657 EXPECT_TRUE(Fullscreen::IsFullscreenElement(*GetDocument().body())); |
| 658 EXPECT_FALSE(GetVideo().IsFullscreen()); | 658 EXPECT_FALSE(GetVideo().IsFullscreen()); |
| 659 | 659 |
| 660 // Leave video paused (playing is not a requirement to exit fullscreen). | 660 // Leave video paused (playing is not a requirement to exit fullscreen). |
| 661 EXPECT_TRUE(GetVideo().paused()); | 661 EXPECT_TRUE(GetVideo().paused()); |
| 662 EXPECT_FALSE(ObservedVisibility()); | 662 EXPECT_FALSE(ObservedVisibility()); |
| 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::IsFullscreenElement(*GetDocument().body())); |
| 669 EXPECT_FALSE(GetVideo().IsFullscreen()); | 669 EXPECT_FALSE(GetVideo().IsFullscreen()); |
| 670 } | 670 } |
| 671 | 671 |
| 672 } // namespace blink | 672 } // namespace blink |
| OLD | NEW |