| 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 "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 TEST_F(WebMediaPlayerImplTest, ConstructAndDestroy) { | 269 TEST_F(WebMediaPlayerImplTest, ConstructAndDestroy) { |
| 270 InitializeDefaultWebMediaPlayerImpl(); | 270 InitializeDefaultWebMediaPlayerImpl(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 TEST_F(WebMediaPlayerImplTest, DidLoadingProgressClearsIdle) { | 273 TEST_F(WebMediaPlayerImplTest, DidLoadingProgressClearsIdle) { |
| 274 testing::StrictMock<MockWebMediaPlayerDelegate> strict_delegate; | 274 testing::StrictMock<MockWebMediaPlayerDelegate> strict_delegate; |
| 275 EXPECT_CALL(strict_delegate, AddObserver(_)); | 275 EXPECT_CALL(strict_delegate, AddObserver(_)); |
| 276 EXPECT_CALL(strict_delegate, IsPlayingBackgroundVideo()).Times(AnyNumber()); | 276 EXPECT_CALL(strict_delegate, IsPlayingBackgroundVideo()).Times(AnyNumber()); |
| 277 InitializeWebMediaPlayerImpl(strict_delegate.AsWeakPtr()); | 277 InitializeWebMediaPlayerImpl(strict_delegate.AsWeakPtr()); |
| 278 EXPECT_FALSE(IsSuspended()); | 278 EXPECT_FALSE(IsSuspended()); |
| 279 EXPECT_CALL(strict_delegate, PlayerGone(0)); | |
| 280 wmpi_->OnSuspendRequested(false); | 279 wmpi_->OnSuspendRequested(false); |
| 281 base::RunLoop().RunUntilIdle(); | 280 base::RunLoop().RunUntilIdle(); |
| 282 EXPECT_TRUE(IsSuspended()); | 281 EXPECT_TRUE(IsSuspended()); |
| 283 AddBufferedRanges(); | 282 AddBufferedRanges(); |
| 284 EXPECT_CALL(strict_delegate, PlayerGone(0)); | |
| 285 wmpi_->didLoadingProgress(); | 283 wmpi_->didLoadingProgress(); |
| 286 base::RunLoop().RunUntilIdle(); | 284 base::RunLoop().RunUntilIdle(); |
| 287 EXPECT_FALSE(IsSuspended()); | 285 EXPECT_FALSE(IsSuspended()); |
| 288 } | 286 } |
| 289 | 287 |
| 290 TEST_F(WebMediaPlayerImplTest, ComputePlayState_AfterConstruction) { | 288 TEST_F(WebMediaPlayerImplTest, ComputePlayState_AfterConstruction) { |
| 291 InitializeDefaultWebMediaPlayerImpl(); | 289 InitializeDefaultWebMediaPlayerImpl(); |
| 292 WebMediaPlayerImpl::PlayState state; | 290 WebMediaPlayerImpl::PlayState state; |
| 293 | 291 |
| 294 state = ComputePlayState(); | 292 state = ComputePlayState(); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 EXPECT_CALL(delegate_, IsPlayingBackgroundVideo()).WillOnce(Return(false)); | 649 EXPECT_CALL(delegate_, IsPlayingBackgroundVideo()).WillOnce(Return(false)); |
| 652 EXPECT_CALL(delegate_, IsHidden()).WillRepeatedly(Return(true)); | 650 EXPECT_CALL(delegate_, IsHidden()).WillRepeatedly(Return(true)); |
| 653 | 651 |
| 654 state = ComputeBackgroundedPlayState(); | 652 state = ComputeBackgroundedPlayState(); |
| 655 EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state); | 653 EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PAUSED, state.delegate_state); |
| 656 EXPECT_FALSE(state.is_memory_reporting_enabled); | 654 EXPECT_FALSE(state.is_memory_reporting_enabled); |
| 657 EXPECT_TRUE(state.is_suspended); | 655 EXPECT_TRUE(state.is_suspended); |
| 658 } | 656 } |
| 659 | 657 |
| 660 } // namespace media | 658 } // namespace media |
| OLD | NEW |