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 <string> | 5 #include <string> |
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/threading/simple_thread.h" | 10 #include "base/threading/simple_thread.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 EXPECT_CALL(*mocks_->video_decoder(), | 135 EXPECT_CALL(*mocks_->video_decoder(), |
136 Seek(mocks_->demuxer()->GetStartTime(), _)) | 136 Seek(mocks_->demuxer()->GetStartTime(), _)) |
137 .WillOnce(Invoke(&RunFilterStatusCB)); | 137 .WillOnce(Invoke(&RunFilterStatusCB)); |
138 EXPECT_CALL(*mocks_->video_decoder(), Stop(_)) | 138 EXPECT_CALL(*mocks_->video_decoder(), Stop(_)) |
139 .WillOnce(Invoke(&RunStopFilterCallback)); | 139 .WillOnce(Invoke(&RunStopFilterCallback)); |
140 } | 140 } |
141 | 141 |
142 // Sets up expectations to allow the audio decoder to initialize. | 142 // Sets up expectations to allow the audio decoder to initialize. |
143 void InitializeAudioDecoder(MockDemuxerStream* stream) { | 143 void InitializeAudioDecoder(MockDemuxerStream* stream) { |
144 EXPECT_CALL(*mocks_->audio_decoder(), Initialize(stream, _, _)) | 144 EXPECT_CALL(*mocks_->audio_decoder(), Initialize(stream, _, _)) |
145 .WillOnce(Invoke(&RunFilterCallback3)); | 145 .WillOnce(Invoke(&RunPipelineStatusCB3)); |
146 EXPECT_CALL(*mocks_->audio_decoder(), SetPlaybackRate(0.0f)); | 146 EXPECT_CALL(*mocks_->audio_decoder(), SetPlaybackRate(0.0f)); |
147 EXPECT_CALL(*mocks_->audio_decoder(), Seek(base::TimeDelta(), _)) | 147 EXPECT_CALL(*mocks_->audio_decoder(), Seek(base::TimeDelta(), _)) |
148 .WillOnce(Invoke(&RunFilterStatusCB)); | 148 .WillOnce(Invoke(&RunFilterStatusCB)); |
149 EXPECT_CALL(*mocks_->audio_decoder(), Stop(_)) | 149 EXPECT_CALL(*mocks_->audio_decoder(), Stop(_)) |
150 .WillOnce(Invoke(&RunStopFilterCallback)); | 150 .WillOnce(Invoke(&RunStopFilterCallback)); |
151 } | 151 } |
152 | 152 |
153 // Sets up expectations to allow the video renderer to initialize. | 153 // Sets up expectations to allow the video renderer to initialize. |
154 void InitializeVideoRenderer() { | 154 void InitializeVideoRenderer() { |
155 EXPECT_CALL(*mocks_->video_renderer(), | 155 EXPECT_CALL(*mocks_->video_renderer(), |
156 Initialize(mocks_->video_decoder(), _, _)) | 156 Initialize(mocks_->video_decoder(), _, _)) |
157 .WillOnce(Invoke(&RunFilterCallback3)); | 157 .WillOnce(Invoke(&RunPipelineStatusCB3)); |
158 EXPECT_CALL(*mocks_->video_renderer(), SetPlaybackRate(0.0f)); | 158 EXPECT_CALL(*mocks_->video_renderer(), SetPlaybackRate(0.0f)); |
159 EXPECT_CALL(*mocks_->video_renderer(), | 159 EXPECT_CALL(*mocks_->video_renderer(), |
160 Seek(mocks_->demuxer()->GetStartTime(), _)) | 160 Seek(mocks_->demuxer()->GetStartTime(), _)) |
161 .WillOnce(Invoke(&RunFilterStatusCB)); | 161 .WillOnce(Invoke(&RunFilterStatusCB)); |
162 EXPECT_CALL(*mocks_->video_renderer(), Stop(_)) | 162 EXPECT_CALL(*mocks_->video_renderer(), Stop(_)) |
163 .WillOnce(Invoke(&RunStopFilterCallback)); | 163 .WillOnce(Invoke(&RunStopFilterCallback)); |
164 } | 164 } |
165 | 165 |
166 // Sets up expectations to allow the audio renderer to initialize. | 166 // Sets up expectations to allow the audio renderer to initialize. |
167 void InitializeAudioRenderer(bool disable_after_init_callback = false) { | 167 void InitializeAudioRenderer(bool disable_after_init_callback = false) { |
168 if (disable_after_init_callback) { | 168 if (disable_after_init_callback) { |
169 EXPECT_CALL(*mocks_->audio_renderer(), | 169 EXPECT_CALL(*mocks_->audio_renderer(), |
170 Initialize(mocks_->audio_decoder(), _, _)) | 170 Initialize(mocks_->audio_decoder(), _, _)) |
171 .WillOnce(DoAll(Invoke(&RunFilterCallback3), | 171 .WillOnce(DoAll(Invoke(&RunPipelineStatusCB3), |
172 DisableAudioRenderer(mocks_->audio_renderer()))); | 172 DisableAudioRenderer(mocks_->audio_renderer()))); |
173 } else { | 173 } else { |
174 EXPECT_CALL(*mocks_->audio_renderer(), | 174 EXPECT_CALL(*mocks_->audio_renderer(), |
175 Initialize(mocks_->audio_decoder(), _, _)) | 175 Initialize(mocks_->audio_decoder(), _, _)) |
176 .WillOnce(Invoke(&RunFilterCallback3)); | 176 .WillOnce(Invoke(&RunPipelineStatusCB3)); |
177 } | 177 } |
178 EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(0.0f)); | 178 EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(0.0f)); |
179 EXPECT_CALL(*mocks_->audio_renderer(), SetVolume(1.0f)); | 179 EXPECT_CALL(*mocks_->audio_renderer(), SetVolume(1.0f)); |
180 EXPECT_CALL(*mocks_->audio_renderer(), Seek(base::TimeDelta(), _)) | 180 EXPECT_CALL(*mocks_->audio_renderer(), Seek(base::TimeDelta(), _)) |
181 .WillOnce(Invoke(&RunFilterStatusCB)); | 181 .WillOnce(Invoke(&RunFilterStatusCB)); |
182 EXPECT_CALL(*mocks_->audio_renderer(), Stop(_)) | 182 EXPECT_CALL(*mocks_->audio_renderer(), Stop(_)) |
183 .WillOnce(Invoke(&RunStopFilterCallback)); | 183 .WillOnce(Invoke(&RunStopFilterCallback)); |
184 } | 184 } |
185 | 185 |
186 // Sets up expectations on the callback and initializes the pipeline. Called | 186 // Sets up expectations on the callback and initializes the pipeline. Called |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(0)); | 911 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(0)); |
912 } | 912 } |
913 | 913 |
914 // Test that different-thread, some-delay callback (the expected common case) | 914 // Test that different-thread, some-delay callback (the expected common case) |
915 // works correctly. | 915 // works correctly. |
916 TEST(PipelineStatusNotificationTest, DelayedCallback) { | 916 TEST(PipelineStatusNotificationTest, DelayedCallback) { |
917 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(20)); | 917 TestPipelineStatusNotification(base::TimeDelta::FromMilliseconds(20)); |
918 } | 918 } |
919 | 919 |
920 } // namespace media | 920 } // namespace media |
OLD | NEW |