| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 ON_CALL(*decoder_, Decode(_, _)) | 64 ON_CALL(*decoder_, Decode(_, _)) |
| 65 .WillByDefault(Invoke(this, &VideoRendererImplTest::DecodeRequested)); | 65 .WillByDefault(Invoke(this, &VideoRendererImplTest::DecodeRequested)); |
| 66 ON_CALL(*decoder_, Reset(_)) | 66 ON_CALL(*decoder_, Reset(_)) |
| 67 .WillByDefault(Invoke(this, &VideoRendererImplTest::FlushRequested)); | 67 .WillByDefault(Invoke(this, &VideoRendererImplTest::FlushRequested)); |
| 68 return decoders; | 68 return decoders; |
| 69 } | 69 } |
| 70 | 70 |
| 71 VideoRendererImplTest() | 71 VideoRendererImplTest() |
| 72 : tick_clock_(new base::SimpleTestTickClock()), | 72 : tick_clock_(new base::SimpleTestTickClock()), |
| 73 decoder_(nullptr), | 73 decoder_(nullptr), |
| 74 demuxer_stream_(DemuxerStream::VIDEO) { | 74 demuxer_stream_(DemuxerStream::VIDEO), |
| 75 expect_init_success_(true) { |
| 75 null_video_sink_.reset(new NullVideoSink( | 76 null_video_sink_.reset(new NullVideoSink( |
| 76 false, base::TimeDelta::FromSecondsD(1.0 / 60), | 77 false, base::TimeDelta::FromSecondsD(1.0 / 60), |
| 77 base::Bind(&MockCB::FrameReceived, base::Unretained(&mock_cb_)), | 78 base::Bind(&MockCB::FrameReceived, base::Unretained(&mock_cb_)), |
| 78 message_loop_.task_runner())); | 79 message_loop_.task_runner())); |
| 79 | 80 |
| 80 renderer_.reset(new VideoRendererImpl( | 81 renderer_.reset(new VideoRendererImpl( |
| 81 message_loop_.task_runner(), message_loop_.task_runner().get(), | 82 message_loop_.task_runner(), message_loop_.task_runner().get(), |
| 82 null_video_sink_.get(), | 83 null_video_sink_.get(), |
| 83 base::Bind(&VideoRendererImplTest::CreateVideoDecodersForTest, | 84 base::Bind(&VideoRendererImplTest::CreateVideoDecodersForTest, |
| 84 base::Unretained(this)), | 85 base::Unretained(this)), |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 554 |
| 554 TEST_F(VideoRendererImplTest, ReinitializeForAnotherStream) { | 555 TEST_F(VideoRendererImplTest, ReinitializeForAnotherStream) { |
| 555 Initialize(); | 556 Initialize(); |
| 556 StartPlayingFrom(0); | 557 StartPlayingFrom(0); |
| 557 Flush(); | 558 Flush(); |
| 558 NiceMock<MockDemuxerStream> new_stream(DemuxerStream::VIDEO); | 559 NiceMock<MockDemuxerStream> new_stream(DemuxerStream::VIDEO); |
| 559 new_stream.set_video_decoder_config(TestVideoConfig::Normal()); | 560 new_stream.set_video_decoder_config(TestVideoConfig::Normal()); |
| 560 InitializeRenderer(&new_stream, false, true); | 561 InitializeRenderer(&new_stream, false, true); |
| 561 } | 562 } |
| 562 | 563 |
| 563 // crbug.com/711318. | 564 TEST_F(VideoRendererImplTest, DestroyWhileInitializing) { |
| 564 #if defined(MEMORY_SANITIZER) | |
| 565 #define MAYBE_DestroyWhileInitializing DISABLED_DestroyWhileInitializing | |
| 566 #else | |
| 567 #define MAYBE_DestroyWhileInitializing DestroyWhileInitializing | |
| 568 #endif | |
| 569 TEST_F(VideoRendererImplTest, MAYBE_DestroyWhileInitializing) { | |
| 570 CallInitialize(&demuxer_stream_, NewExpectedStatusCB(PIPELINE_ERROR_ABORT), | 565 CallInitialize(&demuxer_stream_, NewExpectedStatusCB(PIPELINE_ERROR_ABORT), |
| 571 false, PIPELINE_OK); | 566 false, PIPELINE_OK); |
| 572 Destroy(); | 567 Destroy(); |
| 573 } | 568 } |
| 574 | 569 |
| 575 TEST_F(VideoRendererImplTest, DestroyWhileFlushing) { | 570 TEST_F(VideoRendererImplTest, DestroyWhileFlushing) { |
| 576 Initialize(); | 571 Initialize(); |
| 577 QueueFrames("0 10 20 30"); | 572 QueueFrames("0 10 20 30"); |
| 578 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestampMatcher(0))); | 573 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestampMatcher(0))); |
| 579 EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 574 EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 QueueFrames("0 10 20 30"); | 1211 QueueFrames("0 10 20 30"); |
| 1217 StartPlayingFrom(0); | 1212 StartPlayingFrom(0); |
| 1218 Flush(); | 1213 Flush(); |
| 1219 ASSERT_EQ(1u, frame_ready_cbs_.size()); | 1214 ASSERT_EQ(1u, frame_ready_cbs_.size()); |
| 1220 // This frame will be discarded. | 1215 // This frame will be discarded. |
| 1221 frame_ready_cbs_.front().Run(); | 1216 frame_ready_cbs_.front().Run(); |
| 1222 Destroy(); | 1217 Destroy(); |
| 1223 } | 1218 } |
| 1224 | 1219 |
| 1225 } // namespace media | 1220 } // namespace media |
| OLD | NEW |