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

Unified Diff: media/base/pipeline_impl_unittest.cc

Issue 5744002: Refactor PipelineImpl to use CompositeFilter to manage Filter state transitions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix CR nits & remove dead code. Created 9 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/pipeline_impl.cc ('k') | media/media.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/pipeline_impl_unittest.cc
diff --git a/media/base/pipeline_impl_unittest.cc b/media/base/pipeline_impl_unittest.cc
index 11165824145b2c451832b0e8819c65e1bc6a13c2..eff949843aa747bdb906eb2bde86418c74362062 100644
--- a/media/base/pipeline_impl_unittest.cc
+++ b/media/base/pipeline_impl_unittest.cc
@@ -180,10 +180,17 @@ class PipelineImplTest : public ::testing::Test {
}
// Sets up expectations to allow the audio renderer to initialize.
- void InitializeAudioRenderer() {
- EXPECT_CALL(*mocks_->audio_renderer(),
- Initialize(mocks_->audio_decoder(), NotNull()))
- .WillOnce(Invoke(&RunFilterCallback));
+ void InitializeAudioRenderer(bool disable_after_init_callback = false) {
+ if (disable_after_init_callback) {
+ EXPECT_CALL(*mocks_->audio_renderer(),
+ Initialize(mocks_->audio_decoder(), NotNull()))
+ .WillOnce(DoAll(Invoke(&RunFilterCallback),
+ DisableAudioRenderer(mocks_->audio_renderer())));
+ } else {
+ EXPECT_CALL(*mocks_->audio_renderer(),
+ Initialize(mocks_->audio_decoder(), NotNull()))
+ .WillOnce(Invoke(&RunFilterCallback));
+ }
EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(0.0f));
EXPECT_CALL(*mocks_->audio_renderer(), SetVolume(1.0f));
EXPECT_CALL(*mocks_->audio_renderer(), Seek(base::TimeDelta(), NotNull()))
@@ -641,6 +648,47 @@ TEST_F(PipelineImplTest, DisableAudioRenderer) {
host->NotifyEnded();
}
+TEST_F(PipelineImplTest, DisableAudioRendererDuringInit) {
+ CreateAudioStream();
+ CreateVideoStream();
+ MockDemuxerStreamVector streams;
+ streams.push_back(audio_stream());
+ streams.push_back(video_stream());
+
+ InitializeDataSource();
+ InitializeDemuxer(&streams, base::TimeDelta());
+ InitializeAudioDecoder(audio_stream());
+ InitializeAudioRenderer(true);
+ InitializeVideoDecoder(video_stream());
+ InitializeVideoRenderer();
+
+ EXPECT_CALL(*mocks_->data_source(),
+ OnAudioRendererDisabled());
+ EXPECT_CALL(*mocks_->demuxer(),
+ OnAudioRendererDisabled());
+ EXPECT_CALL(*mocks_->audio_decoder(),
+ OnAudioRendererDisabled());
+ EXPECT_CALL(*mocks_->audio_renderer(),
+ OnAudioRendererDisabled());
+ EXPECT_CALL(*mocks_->video_decoder(),
+ OnAudioRendererDisabled());
+ EXPECT_CALL(*mocks_->video_renderer(),
+ OnAudioRendererDisabled());
+
+ InitializePipeline();
+ EXPECT_TRUE(pipeline_->IsInitialized());
+ EXPECT_EQ(PIPELINE_OK, pipeline_->GetError());
+ EXPECT_FALSE(pipeline_->IsRendered(mime_type::kMajorTypeAudio));
+ EXPECT_TRUE(pipeline_->IsRendered(mime_type::kMajorTypeVideo));
+
+ // Verify that ended event is fired when video ends.
+ EXPECT_CALL(*mocks_->video_renderer(), HasEnded())
+ .WillOnce(Return(true));
+ EXPECT_CALL(callbacks_, OnEnded());
+ FilterHost* host = pipeline_;
+ host->NotifyEnded();
+}
+
TEST_F(PipelineImplTest, EndedCallback) {
CreateAudioStream();
CreateVideoStream();
« no previous file with comments | « media/base/pipeline_impl.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698