Chromium Code Reviews| 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 | 328 |
| 329 simulateEnterFullscreen(); | 329 simulateEnterFullscreen(); |
| 330 // State set to MaybeLockedFullscreen. | 330 // State set to MaybeLockedFullscreen. |
| 331 simulateExitFullscreen(); | 331 simulateExitFullscreen(); |
| 332 | 332 |
| 333 EXPECT_FALSE(delegateWillUnlockFullscreen()); | 333 EXPECT_FALSE(delegateWillUnlockFullscreen()); |
| 334 checkStatePendingFullscreen(); | 334 checkStatePendingFullscreen(); |
| 335 } | 335 } |
| 336 | 336 |
| 337 TEST_F(MediaControlsOrientationLockDelegateTest, | 337 TEST_F(MediaControlsOrientationLockDelegateTest, |
| 338 ReceivedMetadataAfterExitingFullscreen) { | 338 ReceivedMetadataAfterExitingFullscreen) { |
|
chcunningham
2017/01/04 00:11:54
Mounir, some questions for you here.
This test c
| |
| 339 EXPECT_CALL(screenOrientationController(), lock(_)).Times(1); | 339 EXPECT_CALL(screenOrientationController(), lock(_)).Times(1); |
| 340 | 340 |
| 341 simulateEnterFullscreen(); | 341 simulateEnterFullscreen(); |
| 342 // State set to PendingMetadata. | 342 // State set to PendingMetadata. |
|
chcunningham
2017/01/04 00:11:54
This comment is dangling.
mlamouri (slow - plz ping)
2017/01/10 14:29:30
It's not though I agree it's unclear: the internal
| |
| 343 | 343 |
| 344 // Set up the WebMediaPlayer instance. | |
| 345 video().setSrc("http://example.com"); | |
| 346 testing::runPendingTasks(); | |
| 347 | |
| 344 simulateVideoNetworkState(HTMLMediaElement::kNetworkIdle); | 348 simulateVideoNetworkState(HTMLMediaElement::kNetworkIdle); |
| 345 simulateVideoReadyState(HTMLMediaElement::kHaveMetadata); | 349 simulateVideoReadyState(HTMLMediaElement::kHaveMetadata); |
| 346 testing::runPendingTasks(); | 350 testing::runPendingTasks(); |
| 347 | 351 |
| 348 checkStateMaybeLockedFullscreen(); | 352 checkStateMaybeLockedFullscreen(); |
| 349 } | 353 } |
| 350 | 354 |
| 351 TEST_F(MediaControlsOrientationLockDelegateTest, ReceivedMetadataLater) { | 355 TEST_F(MediaControlsOrientationLockDelegateTest, ReceivedMetadataLater) { |
| 352 EXPECT_CALL(screenOrientationController(), lock(_)).Times(0); | 356 EXPECT_CALL(screenOrientationController(), lock(_)).Times(0); |
| 353 EXPECT_CALL(screenOrientationController(), mockUnlock()).Times(0); | 357 EXPECT_CALL(screenOrientationController(), mockUnlock()).Times(0); |
| 354 | 358 |
| 355 simulateEnterFullscreen(); | 359 simulateEnterFullscreen(); |
| 356 // State set to PendingMetadata. | 360 // State set to PendingMetadata. |
|
chcunningham
2017/01/04 00:11:54
I don't follow this comment.
mlamouri (slow - plz ping)
2017/01/10 14:29:30
As above.
| |
| 357 simulateExitFullscreen(); | 361 simulateExitFullscreen(); |
| 358 | 362 |
| 363 // Set up the WebMediaPlayer instance. | |
| 364 video().setSrc("http://example.com"); | |
| 365 testing::runPendingTasks(); | |
| 366 | |
| 359 simulateVideoNetworkState(HTMLMediaElement::kNetworkIdle); | 367 simulateVideoNetworkState(HTMLMediaElement::kNetworkIdle); |
| 360 simulateVideoReadyState(HTMLMediaElement::kHaveMetadata); | 368 simulateVideoReadyState(HTMLMediaElement::kHaveMetadata); |
| 361 testing::runPendingTasks(); | 369 testing::runPendingTasks(); |
| 362 | 370 |
| 363 checkStatePendingFullscreen(); | 371 checkStatePendingFullscreen(); |
| 364 } | 372 } |
| 365 | 373 |
| 366 TEST_F(MediaControlsOrientationLockDelegateTest, ComputeOrientationLock) { | 374 TEST_F(MediaControlsOrientationLockDelegateTest, ComputeOrientationLock) { |
| 367 // Set up the WebMediaPlayer instance. | 375 // Set up the WebMediaPlayer instance. |
| 368 video().setSrc("http://example.com"); | 376 video().setSrc("http://example.com"); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); | 420 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); |
| 413 | 421 |
| 414 screenInfo.orientationType = WebScreenOrientationLandscapeSecondary; | 422 screenInfo.orientationType = WebScreenOrientationLandscapeSecondary; |
| 415 EXPECT_CALL(chromeClient(), screenInfo()) | 423 EXPECT_CALL(chromeClient(), screenInfo()) |
| 416 .Times(1) | 424 .Times(1) |
| 417 .WillOnce(Return(screenInfo)); | 425 .WillOnce(Return(screenInfo)); |
| 418 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); | 426 EXPECT_EQ(WebScreenOrientationLockLandscape, computeOrientationLock()); |
| 419 } | 427 } |
| 420 | 428 |
| 421 } // namespace blink | 429 } // namespace blink |
| OLD | NEW |