| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 static bool hasDelegate(const MediaControls& mediaControls) { | 164 static bool hasDelegate(const MediaControls& mediaControls) { |
| 165 return !!mediaControls.m_orientationLockDelegate; | 165 return !!mediaControls.m_orientationLockDelegate; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void simulateEnterFullscreen() { | 168 void simulateEnterFullscreen() { |
| 169 UserGestureIndicator gesture(DocumentUserGestureToken::create(&document())); | 169 UserGestureIndicator gesture(DocumentUserGestureToken::create(&document())); |
| 170 | 170 |
| 171 Fullscreen::requestFullscreen(video()); | 171 Fullscreen::requestFullscreen(video()); |
| 172 Fullscreen::from(document()).didEnterFullscreen(); | 172 Fullscreen::from(document()).didEnterFullscreen(); |
| 173 testing::runPendingTasks(); | 173 document().serviceScriptedAnimations(WTF::monotonicallyIncreasingTime()); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void simulateExitFullscreen() { | 176 void simulateExitFullscreen() { |
| 177 Fullscreen::exitFullscreen(document()); | 177 Fullscreen::exitFullscreen(document()); |
| 178 Fullscreen::from(document()).didExitFullscreen(); | 178 Fullscreen::from(document()).didExitFullscreen(); |
| 179 testing::runPendingTasks(); | 179 document().serviceScriptedAnimations(WTF::monotonicallyIncreasingTime()); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void simulateOrientationLock() { | 182 void simulateOrientationLock() { |
| 183 ScreenOrientationController* controller = | 183 ScreenOrientationController* controller = |
| 184 ScreenOrientationController::from(*document().frame()); | 184 ScreenOrientationController::from(*document().frame()); |
| 185 controller->lock(WebScreenOrientationLockLandscape, | 185 controller->lock(WebScreenOrientationLockLandscape, |
| 186 WTF::wrapUnique(new DummyScreenOrientationCallback)); | 186 WTF::wrapUnique(new DummyScreenOrientationCallback)); |
| 187 EXPECT_TRUE(controller->maybeHasActiveLock()); | 187 EXPECT_TRUE(controller->maybeHasActiveLock()); |
| 188 } | 188 } |
| 189 | 189 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); | 412 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); |
| 413 | 413 |
| 414 screenInfo.orientationType = WebScreenOrientationLandscapeSecondary; | 414 screenInfo.orientationType = WebScreenOrientationLandscapeSecondary; |
| 415 EXPECT_CALL(chromeClient(), screenInfo()) | 415 EXPECT_CALL(chromeClient(), screenInfo()) |
| 416 .Times(1) | 416 .Times(1) |
| 417 .WillOnce(Return(screenInfo)); | 417 .WillOnce(Return(screenInfo)); |
| 418 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); | 418 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); |
| 419 } | 419 } |
| 420 | 420 |
| 421 } // namespace blink | 421 } // namespace blink |
| OLD | NEW |