| 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 "core/html/shadow/MediaControlsOrientationLockDelegate.h" | 5 #include "core/html/shadow/MediaControlsOrientationLockDelegate.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/DocumentUserGestureToken.h" | 8 #include "core/dom/DocumentUserGestureToken.h" |
| 9 #include "core/dom/Fullscreen.h" | 9 #include "core/dom/Fullscreen.h" |
| 10 #include "core/frame/ScreenOrientationController.h" | 10 #include "core/frame/ScreenOrientationController.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 static bool hasDelegate(const MediaControls& mediaControls) { | 163 static bool hasDelegate(const MediaControls& mediaControls) { |
| 164 return !!mediaControls.m_orientationLockDelegate; | 164 return !!mediaControls.m_orientationLockDelegate; |
| 165 } | 165 } |
| 166 | 166 |
| 167 void simulateEnterFullscreen() { | 167 void simulateEnterFullscreen() { |
| 168 UserGestureIndicator gesture(DocumentUserGestureToken::create(&document())); | 168 UserGestureIndicator gesture(DocumentUserGestureToken::create(&document())); |
| 169 | 169 |
| 170 Fullscreen::requestFullscreen(video()); | 170 Fullscreen::requestFullscreen(video()); |
| 171 Fullscreen::from(document()).didEnterFullscreen(); | 171 Fullscreen::from(document()).didEnterFullscreen(); |
| 172 document().serviceScriptedAnimations(WTF::monotonicallyIncreasingTime()); | 172 testing::runPendingTasks(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void simulateExitFullscreen() { | 175 void simulateExitFullscreen() { |
| 176 Fullscreen::exitFullscreen(document()); | 176 Fullscreen::exitFullscreen(document()); |
| 177 Fullscreen::from(document()).didExitFullscreen(); | 177 Fullscreen::from(document()).didExitFullscreen(); |
| 178 document().serviceScriptedAnimations(WTF::monotonicallyIncreasingTime()); | 178 testing::runPendingTasks(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void simulateOrientationLock() { | 181 void simulateOrientationLock() { |
| 182 ScreenOrientationController* controller = | 182 ScreenOrientationController* controller = |
| 183 ScreenOrientationController::from(*document().frame()); | 183 ScreenOrientationController::from(*document().frame()); |
| 184 controller->lock(WebScreenOrientationLockLandscape, | 184 controller->lock(WebScreenOrientationLockLandscape, |
| 185 WTF::wrapUnique(new DummyScreenOrientationCallback)); | 185 WTF::wrapUnique(new DummyScreenOrientationCallback)); |
| 186 EXPECT_TRUE(controller->maybeHasActiveLock()); | 186 EXPECT_TRUE(controller->maybeHasActiveLock()); |
| 187 } | 187 } |
| 188 | 188 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); | 419 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); |
| 420 | 420 |
| 421 screenInfo.orientationType = WebScreenOrientationLandscapeSecondary; | 421 screenInfo.orientationType = WebScreenOrientationLandscapeSecondary; |
| 422 EXPECT_CALL(chromeClient(), screenInfo()) | 422 EXPECT_CALL(chromeClient(), screenInfo()) |
| 423 .Times(1) | 423 .Times(1) |
| 424 .WillOnce(Return(screenInfo)); | 424 .WillOnce(Return(screenInfo)); |
| 425 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); | 425 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); |
| 426 } | 426 } |
| 427 | 427 |
| 428 } // namespace blink | 428 } // namespace blink |
| OLD | NEW |