Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Side by Side Diff: media/base/pipeline_impl_unittest.cc

Issue 159246: Merged PipelineInternal into PipelineImpl, eliminating a ton of thread-UNsafeness and confusion. (Closed)
Patch Set: Fixed error logging Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/pipeline_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 <string> 5 #include <string>
6 6
7 #include "base/waitable_event.h" 7 #include "base/waitable_event.h"
8 #include "media/base/pipeline_impl.h" 8 #include "media/base/pipeline_impl.h"
9 #include "media/base/media_format.h" 9 #include "media/base/media_format.h"
10 #include "media/base/filters.h" 10 #include "media/base/filters.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 DISALLOW_COPY_AND_ASSIGN(PipelineImplTest); 146 DISALLOW_COPY_AND_ASSIGN(PipelineImplTest);
147 }; 147 };
148 148
149 // Test that playback controls methods no-op when the pipeline hasn't been 149 // Test that playback controls methods no-op when the pipeline hasn't been
150 // started. 150 // started.
151 TEST_F(PipelineImplTest, NotStarted) { 151 TEST_F(PipelineImplTest, NotStarted) {
152 const base::TimeDelta kZero; 152 const base::TimeDelta kZero;
153 153
154 // StrictMock<> will ensure these never get called, and valgrind/purify will 154 // StrictMock<> will ensure these never get called, and valgrind/purify will
155 // make sure the callbacks are instantly deleted. 155 // make sure the callbacks are instantly deleted.
156 pipeline_->Start(NULL, "",
157 NewCallback(reinterpret_cast<CallbackHelper*>(&callbacks_),
158 &CallbackHelper::OnStart));
159 pipeline_->Stop(NewCallback(reinterpret_cast<CallbackHelper*>(&callbacks_), 156 pipeline_->Stop(NewCallback(reinterpret_cast<CallbackHelper*>(&callbacks_),
160 &CallbackHelper::OnStop)); 157 &CallbackHelper::OnStop));
161 pipeline_->Seek(kZero, 158 pipeline_->Seek(kZero,
162 NewCallback(reinterpret_cast<CallbackHelper*>(&callbacks_), 159 NewCallback(reinterpret_cast<CallbackHelper*>(&callbacks_),
163 &CallbackHelper::OnSeek)); 160 &CallbackHelper::OnSeek));
164 161
165 EXPECT_FALSE(pipeline_->IsRunning()); 162 EXPECT_FALSE(pipeline_->IsRunning());
166 EXPECT_FALSE(pipeline_->IsInitialized()); 163 EXPECT_FALSE(pipeline_->IsInitialized());
167 EXPECT_FALSE(pipeline_->IsRendered("")); 164 EXPECT_FALSE(pipeline_->IsRendered(""));
168 EXPECT_FALSE(pipeline_->IsRendered(AudioDecoder::major_mime_type())); 165 EXPECT_FALSE(pipeline_->IsRendered(AudioDecoder::major_mime_type()));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 PIPELINE_ERROR_URL_NOT_FOUND), 234 PIPELINE_ERROR_URL_NOT_FOUND),
238 Invoke(&RunFilterCallback))); 235 Invoke(&RunFilterCallback)));
239 EXPECT_CALL(*mocks_->data_source(), Stop()); 236 EXPECT_CALL(*mocks_->data_source(), Stop());
240 237
241 InitializePipeline(); 238 InitializePipeline();
242 EXPECT_FALSE(pipeline_->IsInitialized()); 239 EXPECT_FALSE(pipeline_->IsInitialized());
243 EXPECT_EQ(PIPELINE_ERROR_URL_NOT_FOUND, pipeline_->GetError()); 240 EXPECT_EQ(PIPELINE_ERROR_URL_NOT_FOUND, pipeline_->GetError());
244 } 241 }
245 242
246 TEST_F(PipelineImplTest, NoStreams) { 243 TEST_F(PipelineImplTest, NoStreams) {
247 // Manually set these expecations because SetPlaybackRate() is not called if 244 // Manually set these expectations because SetPlaybackRate() is not called if
248 // we cannot fully initialize the pipeline. 245 // we cannot fully initialize the pipeline.
249 EXPECT_CALL(*mocks_->data_source(), Initialize("", NotNull())) 246 EXPECT_CALL(*mocks_->data_source(), Initialize("", NotNull()))
250 .WillOnce(Invoke(&RunFilterCallback)); 247 .WillOnce(Invoke(&RunFilterCallback));
251 EXPECT_CALL(*mocks_->data_source(), Stop()); 248 EXPECT_CALL(*mocks_->data_source(), Stop());
252 249
253 EXPECT_CALL(*mocks_->demuxer(), Initialize(mocks_->data_source(), NotNull())) 250 EXPECT_CALL(*mocks_->demuxer(), Initialize(mocks_->data_source(), NotNull()))
254 .WillOnce(Invoke(&RunFilterCallback)); 251 .WillOnce(Invoke(&RunFilterCallback));
255 EXPECT_CALL(*mocks_->demuxer(), GetNumberOfStreams()) 252 EXPECT_CALL(*mocks_->demuxer(), GetNumberOfStreams())
256 .WillRepeatedly(Return(0)); 253 .WillRepeatedly(Return(0));
257 EXPECT_CALL(*mocks_->demuxer(), Stop()); 254 EXPECT_CALL(*mocks_->demuxer(), Stop());
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // The audio renderer should receive a call to SetVolume(). 373 // The audio renderer should receive a call to SetVolume().
377 float expected = 0.5f; 374 float expected = 0.5f;
378 EXPECT_CALL(*mocks_->audio_renderer(), SetVolume(expected)); 375 EXPECT_CALL(*mocks_->audio_renderer(), SetVolume(expected));
379 376
380 // Initialize then set volume! 377 // Initialize then set volume!
381 InitializePipeline(); 378 InitializePipeline();
382 pipeline_->SetVolume(expected); 379 pipeline_->SetVolume(expected);
383 } 380 }
384 381
385 } // namespace media 382 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698