OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/test/simple_test_clock.h" | 10 #include "base/test/simple_test_clock.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // threads these test aren't flaky... why? It's because filters' Initialize() | 76 // threads these test aren't flaky... why? It's because filters' Initialize() |
77 // is executed on |message_loop_| and the mock filters instantly call | 77 // is executed on |message_loop_| and the mock filters instantly call |
78 // InitializationComplete(), which keeps the pipeline humming along. If | 78 // InitializationComplete(), which keeps the pipeline humming along. If |
79 // either filters don't call InitializationComplete() immediately or filter | 79 // either filters don't call InitializationComplete() immediately or filter |
80 // initialization is moved to a separate thread this test will become flaky. | 80 // initialization is moved to a separate thread this test will become flaky. |
81 class PipelineTest : public ::testing::Test { | 81 class PipelineTest : public ::testing::Test { |
82 public: | 82 public: |
83 PipelineTest() | 83 PipelineTest() |
84 : pipeline_(new Pipeline(message_loop_.message_loop_proxy(), | 84 : pipeline_(new Pipeline(message_loop_.message_loop_proxy(), |
85 new MediaLog())), | 85 new MediaLog())), |
86 filter_collection_(new FilterCollection()) { | 86 filter_collection_(new FilterCollection()), |
87 demuxer_ = new MockDemuxer(); | 87 demuxer_(new MockDemuxer()) { |
88 filter_collection_->SetDemuxer(demuxer_); | 88 filter_collection_->SetDemuxer(demuxer_.get()); |
89 | 89 |
90 video_renderer_ = new MockVideoRenderer(); | 90 video_renderer_ = new MockVideoRenderer(); |
91 scoped_ptr<VideoRenderer> video_renderer(video_renderer_); | 91 scoped_ptr<VideoRenderer> video_renderer(video_renderer_); |
92 filter_collection_->SetVideoRenderer(video_renderer.Pass()); | 92 filter_collection_->SetVideoRenderer(video_renderer.Pass()); |
93 | 93 |
94 audio_renderer_ = new MockAudioRenderer(); | 94 audio_renderer_ = new MockAudioRenderer(); |
95 scoped_ptr<AudioRenderer> audio_renderer(audio_renderer_); | 95 scoped_ptr<AudioRenderer> audio_renderer(audio_renderer_); |
96 filter_collection_->SetAudioRenderer(audio_renderer.Pass()); | 96 filter_collection_->SetAudioRenderer(audio_renderer.Pass()); |
97 | 97 |
98 // InitializeDemuxer() adds overriding expectations for expected non-NULL | 98 // InitializeDemuxer() adds overriding expectations for expected non-NULL |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); | 288 EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); |
289 } | 289 } |
290 | 290 |
291 // Fixture members. | 291 // Fixture members. |
292 StrictMock<CallbackHelper> callbacks_; | 292 StrictMock<CallbackHelper> callbacks_; |
293 base::SimpleTestClock test_clock_; | 293 base::SimpleTestClock test_clock_; |
294 MessageLoop message_loop_; | 294 MessageLoop message_loop_; |
295 scoped_refptr<Pipeline> pipeline_; | 295 scoped_refptr<Pipeline> pipeline_; |
296 | 296 |
297 scoped_ptr<FilterCollection> filter_collection_; | 297 scoped_ptr<FilterCollection> filter_collection_; |
298 scoped_refptr<MockDemuxer> demuxer_; | 298 scoped_ptr<MockDemuxer> demuxer_; |
299 MockVideoRenderer* video_renderer_; | 299 MockVideoRenderer* video_renderer_; |
300 MockAudioRenderer* audio_renderer_; | 300 MockAudioRenderer* audio_renderer_; |
301 scoped_refptr<StrictMock<MockDemuxerStream> > audio_stream_; | 301 scoped_refptr<StrictMock<MockDemuxerStream> > audio_stream_; |
302 scoped_refptr<StrictMock<MockDemuxerStream> > video_stream_; | 302 scoped_refptr<StrictMock<MockDemuxerStream> > video_stream_; |
303 AudioRenderer::TimeCB audio_time_cb_; | 303 AudioRenderer::TimeCB audio_time_cb_; |
304 VideoDecoderConfig video_decoder_config_; | 304 VideoDecoderConfig video_decoder_config_; |
305 | 305 |
306 private: | 306 private: |
307 DISALLOW_COPY_AND_ASSIGN(PipelineTest); | 307 DISALLOW_COPY_AND_ASSIGN(PipelineTest); |
308 }; | 308 }; |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 INSTANTIATE_TEARDOWN_TEST(Error, InitAudioRenderer); | 1208 INSTANTIATE_TEARDOWN_TEST(Error, InitAudioRenderer); |
1209 INSTANTIATE_TEARDOWN_TEST(Error, InitVideoRenderer); | 1209 INSTANTIATE_TEARDOWN_TEST(Error, InitVideoRenderer); |
1210 INSTANTIATE_TEARDOWN_TEST(Error, Pausing); | 1210 INSTANTIATE_TEARDOWN_TEST(Error, Pausing); |
1211 INSTANTIATE_TEARDOWN_TEST(Error, Flushing); | 1211 INSTANTIATE_TEARDOWN_TEST(Error, Flushing); |
1212 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); | 1212 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); |
1213 INSTANTIATE_TEARDOWN_TEST(Error, Prerolling); | 1213 INSTANTIATE_TEARDOWN_TEST(Error, Prerolling); |
1214 INSTANTIATE_TEARDOWN_TEST(Error, Starting); | 1214 INSTANTIATE_TEARDOWN_TEST(Error, Starting); |
1215 INSTANTIATE_TEARDOWN_TEST(Error, Playing); | 1215 INSTANTIATE_TEARDOWN_TEST(Error, Playing); |
1216 | 1216 |
1217 } // namespace media | 1217 } // namespace media |
OLD | NEW |