| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/MediaControlsOrientationLockDelegate.h" | 5 #include "modules/media_controls/MediaControlsOrientationLockDelegate.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Fullscreen.h" | 8 #include "core/dom/Fullscreen.h" |
| 9 #include "core/dom/UserGestureIndicator.h" | 9 #include "core/dom/UserGestureIndicator.h" |
| 10 #include "core/frame/ScreenOrientationController.h" | 10 #include "core/frame/ScreenOrientationController.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 static bool HasDelegate(const MediaControls& media_controls) { | 133 static bool HasDelegate(const MediaControls& media_controls) { |
| 134 return !!static_cast<const MediaControlsImpl*>(&media_controls) | 134 return !!static_cast<const MediaControlsImpl*>(&media_controls) |
| 135 ->orientation_lock_delegate_; | 135 ->orientation_lock_delegate_; |
| 136 } | 136 } |
| 137 | 137 |
| 138 void SimulateEnterFullscreen() { | 138 void SimulateEnterFullscreen() { |
| 139 UserGestureIndicator gesture(UserGestureToken::Create(&GetDocument())); | 139 UserGestureIndicator gesture(UserGestureToken::Create(&GetDocument())); |
| 140 | 140 |
| 141 Fullscreen::RequestFullscreen(Video()); | 141 Fullscreen::RequestFullscreen(Video()); |
| 142 Fullscreen::From(GetDocument()).DidEnterFullscreen(); | 142 Fullscreen::From(GetDocument()).DidEnterFullscreen(); |
| 143 testing::RunPendingTasks(); | 143 GetDocument().ServiceScriptedAnimations(WTF::MonotonicallyIncreasingTime()); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void SimulateExitFullscreen() { | 146 void SimulateExitFullscreen() { |
| 147 Fullscreen::ExitFullscreen(GetDocument()); | 147 Fullscreen::ExitFullscreen(GetDocument()); |
| 148 Fullscreen::From(GetDocument()).DidExitFullscreen(); | 148 Fullscreen::From(GetDocument()).DidExitFullscreen(); |
| 149 testing::RunPendingTasks(); | 149 GetDocument().ServiceScriptedAnimations(WTF::MonotonicallyIncreasingTime()); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void SimulateOrientationLock() { | 152 void SimulateOrientationLock() { |
| 153 ScreenOrientationController* controller = | 153 ScreenOrientationController* controller = |
| 154 ScreenOrientationController::From(*GetDocument().GetFrame()); | 154 ScreenOrientationController::From(*GetDocument().GetFrame()); |
| 155 controller->lock(kWebScreenOrientationLockLandscape, | 155 controller->lock(kWebScreenOrientationLockLandscape, |
| 156 WTF::WrapUnique(new DummyScreenOrientationCallback)); | 156 WTF::WrapUnique(new DummyScreenOrientationCallback)); |
| 157 EXPECT_TRUE(controller->MaybeHasActiveLock()); | 157 EXPECT_TRUE(controller->MaybeHasActiveLock()); |
| 158 } | 158 } |
| 159 | 159 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 EXPECT_EQ(kWebScreenOrientationLockLandscape, ComputeOrientationLock()); | 394 EXPECT_EQ(kWebScreenOrientationLockLandscape, ComputeOrientationLock()); |
| 395 | 395 |
| 396 screen_info.orientation_type = kWebScreenOrientationLandscapeSecondary; | 396 screen_info.orientation_type = kWebScreenOrientationLandscapeSecondary; |
| 397 EXPECT_CALL(ChromeClient(), GetScreenInfo()) | 397 EXPECT_CALL(ChromeClient(), GetScreenInfo()) |
| 398 .Times(1) | 398 .Times(1) |
| 399 .WillOnce(Return(screen_info)); | 399 .WillOnce(Return(screen_info)); |
| 400 EXPECT_EQ(kWebScreenOrientationLockLandscape, ComputeOrientationLock()); | 400 EXPECT_EQ(kWebScreenOrientationLockLandscape, ComputeOrientationLock()); |
| 401 } | 401 } |
| 402 | 402 |
| 403 } // namespace blink | 403 } // namespace blink |
| OLD | NEW |