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

Side by Side Diff: media/filters/decrypting_audio_decoder_unittest.cc

Issue 11359100: Add RunCallback to invoke a callback parameter in unittests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "media/base/buffers.h" 11 #include "media/base/buffers.h"
12 #include "media/base/data_buffer.h" 12 #include "media/base/data_buffer.h"
13 #include "media/base/decoder_buffer.h" 13 #include "media/base/decoder_buffer.h"
14 #include "media/base/decrypt_config.h" 14 #include "media/base/decrypt_config.h"
15 #include "media/base/gmock_callback_support.h"
15 #include "media/base/mock_callback.h" 16 #include "media/base/mock_callback.h"
16 #include "media/base/mock_filters.h" 17 #include "media/base/mock_filters.h"
17 #include "media/filters/decrypting_audio_decoder.h" 18 #include "media/filters/decrypting_audio_decoder.h"
18 #include "media/filters/ffmpeg_decoder_unittest.h" 19 #include "media/filters/ffmpeg_decoder_unittest.h"
19 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
20 21
21 using ::testing::_; 22 using ::testing::_;
22 using ::testing::AtMost; 23 using ::testing::AtMost;
23 using ::testing::Invoke; 24 using ::testing::Invoke;
24 using ::testing::IsNull; 25 using ::testing::IsNull;
(...skipping 21 matching lines...) Expand all
46 } 47 }
47 48
48 // Use anonymous namespace here to prevent the actions to be defined multiple 49 // Use anonymous namespace here to prevent the actions to be defined multiple
49 // times across multiple test files. Sadly we can't use static for them. 50 // times across multiple test files. Sadly we can't use static for them.
50 namespace { 51 namespace {
51 52
52 ACTION_P(ReturnBuffer, buffer) { 53 ACTION_P(ReturnBuffer, buffer) {
53 arg0.Run(buffer ? DemuxerStream::kOk : DemuxerStream::kAborted, buffer); 54 arg0.Run(buffer ? DemuxerStream::kOk : DemuxerStream::kAborted, buffer);
54 } 55 }
55 56
56 ACTION(ReturnConfigChanged) { 57 ACTION_P(RunCallbackIfNotNull, param) {
57 arg0.Run(DemuxerStream::kConfigChanged, scoped_refptr<DecoderBuffer>(NULL));
58 }
59
60 ACTION_P(RunCallback0, param) {
61 if (!arg0.is_null()) 58 if (!arg0.is_null())
62 arg0.Run(param); 59 arg0.Run(param);
63 } 60 }
64 61
65 ACTION_P(RunCallback1, param) {
66 arg1.Run(param);
67 }
68
69 ACTION_P2(RunCallback2, param1, param2) {
70 arg1.Run(param1, param2);
71 }
72
73 ACTION_P2(ResetAndRunCallback, callback, param) { 62 ACTION_P2(ResetAndRunCallback, callback, param) {
74 base::ResetAndReturn(callback).Run(param); 63 base::ResetAndReturn(callback).Run(param);
75 } 64 }
76 65
77 MATCHER(IsNullCallback, "") { 66 MATCHER(IsEndOfStream, "end of stream") {
78 return (arg.is_null());
79 }
80
81 MATCHER(IsEndOfStream, "") {
82 return (arg->IsEndOfStream()); 67 return (arg->IsEndOfStream());
83 } 68 }
84 69
85 } // namespace 70 } // namespace
86 71
87 class DecryptingAudioDecoderTest : public testing::Test { 72 class DecryptingAudioDecoderTest : public testing::Test {
88 public: 73 public:
89 DecryptingAudioDecoderTest() 74 DecryptingAudioDecoderTest()
90 : decoder_(new StrictMock<DecryptingAudioDecoder>( 75 : decoder_(new StrictMock<DecryptingAudioDecoder>(
91 base::Bind(&Identity<scoped_refptr<base::MessageLoopProxy> >, 76 base::Bind(&Identity<scoped_refptr<base::MessageLoopProxy> >,
(...skipping 21 matching lines...) Expand all
113 98
114 decoder_->Initialize(demuxer_, NewExpectedStatusCB(status), 99 decoder_->Initialize(demuxer_, NewExpectedStatusCB(status),
115 base::Bind(&MockStatisticsCB::OnStatistics, 100 base::Bind(&MockStatisticsCB::OnStatistics,
116 base::Unretained(&statistics_cb_))); 101 base::Unretained(&statistics_cb_)));
117 message_loop_.RunAllPending(); 102 message_loop_.RunAllPending();
118 } 103 }
119 104
120 void Initialize() { 105 void Initialize() {
121 EXPECT_CALL(*decryptor_, InitializeAudioDecoderMock(_, _)) 106 EXPECT_CALL(*decryptor_, InitializeAudioDecoderMock(_, _))
122 .Times(AtMost(1)) 107 .Times(AtMost(1))
123 .WillOnce(RunCallback1(true)); 108 .WillOnce(RunCallback<1>(true));
124 EXPECT_CALL(*this, RequestDecryptorNotification(_)) 109 EXPECT_CALL(*this, RequestDecryptorNotification(_))
125 .WillOnce(RunCallback0(decryptor_.get())); 110 .WillOnce(RunCallbackIfNotNull(decryptor_.get()));
126 EXPECT_CALL(*decryptor_, RegisterKeyAddedCB(Decryptor::kAudio, _)) 111 EXPECT_CALL(*decryptor_, RegisterKeyAddedCB(Decryptor::kAudio, _))
127 .WillOnce(SaveArg<1>(&key_added_cb_)); 112 .WillOnce(SaveArg<1>(&key_added_cb_));
128 113
129 config_.Initialize(kCodecVorbis, 16, CHANNEL_LAYOUT_STEREO, 44100, 114 config_.Initialize(kCodecVorbis, 16, CHANNEL_LAYOUT_STEREO, 44100,
130 NULL, 0, true, true); 115 NULL, 0, true, true);
131 116
132 InitializeAndExpectStatus(config_, PIPELINE_OK); 117 InitializeAndExpectStatus(config_, PIPELINE_OK);
133 EXPECT_EQ(16, decoder_->bits_per_channel()); 118 EXPECT_EQ(16, decoder_->bits_per_channel());
134 EXPECT_EQ(CHANNEL_LAYOUT_STEREO, decoder_->channel_layout()); 119 EXPECT_EQ(CHANNEL_LAYOUT_STEREO, decoder_->channel_layout());
135 EXPECT_EQ(44100, decoder_->samples_per_second()); 120 EXPECT_EQ(44100, decoder_->samples_per_second());
(...skipping 16 matching lines...) Expand all
152 137
153 // Sets up expectations and actions to put DecryptingAudioDecoder in an 138 // Sets up expectations and actions to put DecryptingAudioDecoder in an
154 // active normal decoding state. 139 // active normal decoding state.
155 void EnterNormalDecodingState() { 140 void EnterNormalDecodingState() {
156 Decryptor::AudioBuffers end_of_stream_frames_(1, end_of_stream_frame_); 141 Decryptor::AudioBuffers end_of_stream_frames_(1, end_of_stream_frame_);
157 142
158 EXPECT_CALL(*demuxer_, Read(_)) 143 EXPECT_CALL(*demuxer_, Read(_))
159 .WillOnce(ReturnBuffer(encrypted_buffer_)) 144 .WillOnce(ReturnBuffer(encrypted_buffer_))
160 .WillRepeatedly(ReturnBuffer(DecoderBuffer::CreateEOSBuffer())); 145 .WillRepeatedly(ReturnBuffer(DecoderBuffer::CreateEOSBuffer()));
161 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _)) 146 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _))
162 .WillOnce(RunCallback2(Decryptor::kSuccess, 147 .WillOnce(RunCallback<1>(Decryptor::kSuccess, decoded_frame_list_))
163 decoded_frame_list_)) 148 .WillRepeatedly(RunCallback<1>(Decryptor::kNeedMoreData,
164 .WillRepeatedly(RunCallback2(Decryptor::kNeedMoreData, 149 Decryptor::AudioBuffers()));
165 Decryptor::AudioBuffers()));
166 EXPECT_CALL(statistics_cb_, OnStatistics(_)); 150 EXPECT_CALL(statistics_cb_, OnStatistics(_));
167 151
168 ReadAndExpectFrameReadyWith(AudioDecoder::kOk, decoded_frame_); 152 ReadAndExpectFrameReadyWith(AudioDecoder::kOk, decoded_frame_);
169 } 153 }
170 154
171 // Sets up expectations and actions to put DecryptingAudioDecoder in an end 155 // Sets up expectations and actions to put DecryptingAudioDecoder in an end
172 // of stream state. This function must be called after 156 // of stream state. This function must be called after
173 // EnterNormalDecodingState() to work. 157 // EnterNormalDecodingState() to work.
174 void EnterEndOfStreamState() { 158 void EnterEndOfStreamState() {
175 ReadAndExpectFrameReadyWith(AudioDecoder::kOk, end_of_stream_frame_); 159 ReadAndExpectFrameReadyWith(AudioDecoder::kOk, end_of_stream_frame_);
(...skipping 24 matching lines...) Expand all
200 message_loop_.RunAllPending(); 184 message_loop_.RunAllPending();
201 // Make sure the Read() on the decoder triggers a DecryptAndDecode() on the 185 // Make sure the Read() on the decoder triggers a DecryptAndDecode() on the
202 // decryptor. 186 // decryptor.
203 EXPECT_FALSE(pending_audio_decode_cb_.is_null()); 187 EXPECT_FALSE(pending_audio_decode_cb_.is_null());
204 } 188 }
205 189
206 void EnterWaitingForKeyState() { 190 void EnterWaitingForKeyState() {
207 EXPECT_CALL(*demuxer_, Read(_)) 191 EXPECT_CALL(*demuxer_, Read(_))
208 .WillRepeatedly(ReturnBuffer(encrypted_buffer_)); 192 .WillRepeatedly(ReturnBuffer(encrypted_buffer_));
209 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _)) 193 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _))
210 .WillRepeatedly(RunCallback2(Decryptor::kNoKey, 194 .WillRepeatedly(RunCallback<1>(Decryptor::kNoKey,
211 Decryptor::AudioBuffers())); 195 Decryptor::AudioBuffers()));
212 decoder_->Read(base::Bind(&DecryptingAudioDecoderTest::FrameReady, 196 decoder_->Read(base::Bind(&DecryptingAudioDecoderTest::FrameReady,
213 base::Unretained(this))); 197 base::Unretained(this)));
214 message_loop_.RunAllPending(); 198 message_loop_.RunAllPending();
215 } 199 }
216 200
217 void AbortPendingAudioDecodeCB() { 201 void AbortPendingAudioDecodeCB() {
218 if (!pending_audio_decode_cb_.is_null()) { 202 if (!pending_audio_decode_cb_.is_null()) {
219 base::ResetAndReturn(&pending_audio_decode_cb_).Run( 203 base::ResetAndReturn(&pending_audio_decode_cb_).Run(
220 Decryptor::kSuccess, Decryptor::AudioBuffers()); 204 Decryptor::kSuccess, Decryptor::AudioBuffers());
221 } 205 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 TEST_F(DecryptingAudioDecoderTest, Initialize_InvalidAudioConfig) { 258 TEST_F(DecryptingAudioDecoderTest, Initialize_InvalidAudioConfig) {
275 AudioDecoderConfig config(kUnknownAudioCodec, 0, CHANNEL_LAYOUT_STEREO, 0, 259 AudioDecoderConfig config(kUnknownAudioCodec, 0, CHANNEL_LAYOUT_STEREO, 0,
276 NULL, 0, true); 260 NULL, 0, true);
277 261
278 InitializeAndExpectStatus(config, PIPELINE_ERROR_DECODE); 262 InitializeAndExpectStatus(config, PIPELINE_ERROR_DECODE);
279 } 263 }
280 264
281 // Ensure decoder handles unsupported audio configs without crashing. 265 // Ensure decoder handles unsupported audio configs without crashing.
282 TEST_F(DecryptingAudioDecoderTest, Initialize_UnsupportedAudioConfig) { 266 TEST_F(DecryptingAudioDecoderTest, Initialize_UnsupportedAudioConfig) {
283 EXPECT_CALL(*decryptor_, InitializeAudioDecoderMock(_, _)) 267 EXPECT_CALL(*decryptor_, InitializeAudioDecoderMock(_, _))
284 .WillOnce(RunCallback1(false)); 268 .WillOnce(RunCallback<1>(false));
285 EXPECT_CALL(*this, RequestDecryptorNotification(_)) 269 EXPECT_CALL(*this, RequestDecryptorNotification(_))
286 .WillOnce(RunCallback0(decryptor_.get())); 270 .WillOnce(RunCallbackIfNotNull(decryptor_.get()));
287 271
288 AudioDecoderConfig config(kCodecVorbis, 16, CHANNEL_LAYOUT_STEREO, 44100, 272 AudioDecoderConfig config(kCodecVorbis, 16, CHANNEL_LAYOUT_STEREO, 44100,
289 NULL, 0, true); 273 NULL, 0, true);
290 InitializeAndExpectStatus(config, DECODER_ERROR_NOT_SUPPORTED); 274 InitializeAndExpectStatus(config, DECODER_ERROR_NOT_SUPPORTED);
291 } 275 }
292 276
293 // Test normal decrypt and decode case. 277 // Test normal decrypt and decode case.
294 TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_Normal) { 278 TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_Normal) {
295 Initialize(); 279 Initialize();
296 EnterNormalDecodingState(); 280 EnterNormalDecodingState();
297 } 281 }
298 282
299 // Test the case where the decryptor returns error when doing decrypt and 283 // Test the case where the decryptor returns error when doing decrypt and
300 // decode. 284 // decode.
301 TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_DecodeError) { 285 TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_DecodeError) {
302 Initialize(); 286 Initialize();
303 287
304 EXPECT_CALL(*demuxer_, Read(_)) 288 EXPECT_CALL(*demuxer_, Read(_))
305 .WillRepeatedly(ReturnBuffer(encrypted_buffer_)); 289 .WillRepeatedly(ReturnBuffer(encrypted_buffer_));
306 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _)) 290 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _))
307 .WillRepeatedly(RunCallback2(Decryptor::kError, 291 .WillRepeatedly(RunCallback<1>(Decryptor::kError,
308 Decryptor::AudioBuffers())); 292 Decryptor::AudioBuffers()));
309 293
310 ReadAndExpectFrameReadyWith(AudioDecoder::kDecodeError, NULL); 294 ReadAndExpectFrameReadyWith(AudioDecoder::kDecodeError, NULL);
311 } 295 }
312 296
313 // Test the case where the decryptor returns kNeedMoreData to ask for more 297 // Test the case where the decryptor returns kNeedMoreData to ask for more
314 // buffers before it can produce a frame. 298 // buffers before it can produce a frame.
315 TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_NeedMoreData) { 299 TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_NeedMoreData) {
316 Initialize(); 300 Initialize();
317 301
318 EXPECT_CALL(*demuxer_, Read(_)) 302 EXPECT_CALL(*demuxer_, Read(_))
319 .Times(2) 303 .Times(2)
320 .WillRepeatedly(ReturnBuffer(encrypted_buffer_)); 304 .WillRepeatedly(ReturnBuffer(encrypted_buffer_));
321 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _)) 305 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _))
322 .WillOnce(RunCallback2(Decryptor::kNeedMoreData, 306 .WillOnce(RunCallback<1>(Decryptor::kNeedMoreData,
323 Decryptor::AudioBuffers())) 307 Decryptor::AudioBuffers()))
324 .WillRepeatedly(RunCallback2(Decryptor::kSuccess, decoded_frame_list_)); 308 .WillRepeatedly(RunCallback<1>(Decryptor::kSuccess, decoded_frame_list_));
325 EXPECT_CALL(statistics_cb_, OnStatistics(_)) 309 EXPECT_CALL(statistics_cb_, OnStatistics(_))
326 .Times(2); 310 .Times(2);
327 311
328 ReadAndExpectFrameReadyWith(AudioDecoder::kOk, decoded_frame_); 312 ReadAndExpectFrameReadyWith(AudioDecoder::kOk, decoded_frame_);
329 } 313 }
330 314
331 // Test the case where the decryptor returns multiple decoded frames. 315 // Test the case where the decryptor returns multiple decoded frames.
332 TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_MultipleFrames) { 316 TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_MultipleFrames) {
333 Initialize(); 317 Initialize();
334 318
335 scoped_refptr<DataBuffer> frame_a = new DataBuffer(kFakeAudioFrameSize); 319 scoped_refptr<DataBuffer> frame_a = new DataBuffer(kFakeAudioFrameSize);
336 frame_a->SetDataSize(kFakeAudioFrameSize); 320 frame_a->SetDataSize(kFakeAudioFrameSize);
337 scoped_refptr<DataBuffer> frame_b = new DataBuffer(kFakeAudioFrameSize); 321 scoped_refptr<DataBuffer> frame_b = new DataBuffer(kFakeAudioFrameSize);
338 frame_b->SetDataSize(kFakeAudioFrameSize); 322 frame_b->SetDataSize(kFakeAudioFrameSize);
339 decoded_frame_list_.push_back(frame_a); 323 decoded_frame_list_.push_back(frame_a);
340 decoded_frame_list_.push_back(frame_b); 324 decoded_frame_list_.push_back(frame_b);
341 325
342 EXPECT_CALL(*demuxer_, Read(_)) 326 EXPECT_CALL(*demuxer_, Read(_))
343 .WillOnce(ReturnBuffer(encrypted_buffer_)); 327 .WillOnce(ReturnBuffer(encrypted_buffer_));
344 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _)) 328 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _))
345 .WillOnce(RunCallback2(Decryptor::kSuccess, decoded_frame_list_)); 329 .WillOnce(RunCallback<1>(Decryptor::kSuccess, decoded_frame_list_));
346 EXPECT_CALL(statistics_cb_, OnStatistics(_)); 330 EXPECT_CALL(statistics_cb_, OnStatistics(_));
347 331
348 ReadAndExpectFrameReadyWith(AudioDecoder::kOk, decoded_frame_); 332 ReadAndExpectFrameReadyWith(AudioDecoder::kOk, decoded_frame_);
349 ReadAndExpectFrameReadyWith(AudioDecoder::kOk, frame_a); 333 ReadAndExpectFrameReadyWith(AudioDecoder::kOk, frame_a);
350 ReadAndExpectFrameReadyWith(AudioDecoder::kOk, frame_b); 334 ReadAndExpectFrameReadyWith(AudioDecoder::kOk, frame_b);
351 } 335 }
352 336
353 // Test the case where the decryptor receives end-of-stream buffer. 337 // Test the case where the decryptor receives end-of-stream buffer.
354 TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_EndOfStream) { 338 TEST_F(DecryptingAudioDecoderTest, DecryptAndDecode_EndOfStream) {
355 Initialize(); 339 Initialize();
356 EnterNormalDecodingState(); 340 EnterNormalDecodingState();
357 EnterEndOfStreamState(); 341 EnterEndOfStreamState();
358 } 342 }
359 343
360 // Test the case where the a key is added when the decryptor is in 344 // Test the case where the a key is added when the decryptor is in
361 // kWaitingForKey state. 345 // kWaitingForKey state.
362 TEST_F(DecryptingAudioDecoderTest, KeyAdded_DuringWaitingForKey) { 346 TEST_F(DecryptingAudioDecoderTest, KeyAdded_DuringWaitingForKey) {
363 Initialize(); 347 Initialize();
364 EnterWaitingForKeyState(); 348 EnterWaitingForKeyState();
365 349
366 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _)) 350 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _))
367 .WillRepeatedly(RunCallback2(Decryptor::kSuccess, decoded_frame_list_)); 351 .WillRepeatedly(RunCallback<1>(Decryptor::kSuccess, decoded_frame_list_));
368 EXPECT_CALL(statistics_cb_, OnStatistics(_)); 352 EXPECT_CALL(statistics_cb_, OnStatistics(_));
369 EXPECT_CALL(*this, FrameReady(AudioDecoder::kOk, decoded_frame_)); 353 EXPECT_CALL(*this, FrameReady(AudioDecoder::kOk, decoded_frame_));
370 key_added_cb_.Run(); 354 key_added_cb_.Run();
371 message_loop_.RunAllPending(); 355 message_loop_.RunAllPending();
372 } 356 }
373 357
374 // Test the case where the a key is added when the decryptor is in 358 // Test the case where the a key is added when the decryptor is in
375 // kPendingDecode state. 359 // kPendingDecode state.
376 TEST_F(DecryptingAudioDecoderTest, KeyAdded_DruingPendingDecode) { 360 TEST_F(DecryptingAudioDecoderTest, KeyAdded_DruingPendingDecode) {
377 Initialize(); 361 Initialize();
378 EnterPendingDecodeState(); 362 EnterPendingDecodeState();
379 363
380 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _)) 364 EXPECT_CALL(*decryptor_, DecryptAndDecodeAudio(_, _))
381 .WillRepeatedly(RunCallback2(Decryptor::kSuccess, decoded_frame_list_)); 365 .WillRepeatedly(RunCallback<1>(Decryptor::kSuccess, decoded_frame_list_));
382 EXPECT_CALL(statistics_cb_, OnStatistics(_)); 366 EXPECT_CALL(statistics_cb_, OnStatistics(_));
383 EXPECT_CALL(*this, FrameReady(AudioDecoder::kOk, decoded_frame_)); 367 EXPECT_CALL(*this, FrameReady(AudioDecoder::kOk, decoded_frame_));
384 // The audio decode callback is returned after the correct decryption key is 368 // The audio decode callback is returned after the correct decryption key is
385 // added. 369 // added.
386 key_added_cb_.Run(); 370 key_added_cb_.Run();
387 base::ResetAndReturn(&pending_audio_decode_cb_).Run( 371 base::ResetAndReturn(&pending_audio_decode_cb_).Run(
388 Decryptor::kNoKey, Decryptor::AudioBuffers()); 372 Decryptor::kNoKey, Decryptor::AudioBuffers());
389 message_loop_.RunAllPending(); 373 message_loop_.RunAllPending();
390 } 374 }
391 375
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 base::ResetAndReturn(&pending_demuxer_read_cb_).Run(DemuxerStream::kAborted, 461 base::ResetAndReturn(&pending_demuxer_read_cb_).Run(DemuxerStream::kAborted,
478 NULL); 462 NULL);
479 message_loop_.RunAllPending(); 463 message_loop_.RunAllPending();
480 } 464 }
481 465
482 // Test config change on the demuxer stream. 466 // Test config change on the demuxer stream.
483 TEST_F(DecryptingAudioDecoderTest, DemuxerRead_ConfigChanged) { 467 TEST_F(DecryptingAudioDecoderTest, DemuxerRead_ConfigChanged) {
484 Initialize(); 468 Initialize();
485 469
486 EXPECT_CALL(*demuxer_, Read(_)) 470 EXPECT_CALL(*demuxer_, Read(_))
487 .WillOnce(ReturnConfigChanged()); 471 .WillOnce(RunCallback<0>(DemuxerStream::kConfigChanged,
472 scoped_refptr<DecoderBuffer>()));
488 473
489 // TODO(xhwang): Update this test when kConfigChanged is supported in 474 // TODO(xhwang): Update this test when kConfigChanged is supported in
490 // DecryptingAudioDecoder. 475 // DecryptingAudioDecoder.
491 ReadAndExpectFrameReadyWith(AudioDecoder::kDecodeError, NULL); 476 ReadAndExpectFrameReadyWith(AudioDecoder::kDecodeError, NULL);
492 } 477 }
493 478
494 } // namespace media 479 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/audio_renderer_impl_unittest.cc ('k') | media/filters/decrypting_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698