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

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

Issue 11144036: Update Decryptor interface to support audio decoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove leftover unretained Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « media/filters/decrypting_video_decoder.cc ('k') | media/filters/ffmpeg_video_decoder.cc » ('j') | 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) 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/decoder_buffer.h" 11 #include "media/base/decoder_buffer.h"
12 #include "media/base/decrypt_config.h" 12 #include "media/base/decrypt_config.h"
13 #include "media/base/mock_callback.h" 13 #include "media/base/mock_callback.h"
14 #include "media/base/mock_filters.h" 14 #include "media/base/mock_filters.h"
15 #include "media/base/video_frame.h" 15 #include "media/base/video_frame.h"
16 #include "media/filters/decrypting_video_decoder.h"
16 #include "media/filters/ffmpeg_decoder_unittest.h" 17 #include "media/filters/ffmpeg_decoder_unittest.h"
17 #include "media/filters/decrypting_video_decoder.h"
18 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
19 19
20 using ::testing::_; 20 using ::testing::_;
21 using ::testing::AtMost; 21 using ::testing::AtMost;
22 using ::testing::Invoke; 22 using ::testing::Invoke;
23 using ::testing::IsNull; 23 using ::testing::IsNull;
24 using ::testing::ReturnRef; 24 using ::testing::ReturnRef;
25 using ::testing::SaveArg; 25 using ::testing::SaveArg;
26 using ::testing::StrictMock; 26 using ::testing::StrictMock;
27 27
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 if (!pending_init_cb_.is_null()) { 203 if (!pending_init_cb_.is_null()) {
204 ASSERT_TRUE(pending_video_decode_cb_.is_null()); 204 ASSERT_TRUE(pending_video_decode_cb_.is_null());
205 base::ResetAndReturn(&pending_init_cb_).Run(false); 205 base::ResetAndReturn(&pending_init_cb_).Run(false);
206 return; 206 return;
207 } 207 }
208 208
209 AbortPendingVideoDecodeCB(); 209 AbortPendingVideoDecodeCB();
210 } 210 }
211 211
212 void Reset() { 212 void Reset() {
213 EXPECT_CALL(*decryptor_, CancelDecryptAndDecodeVideo()) 213 EXPECT_CALL(*decryptor_, ResetDecoder(Decryptor::kVideo))
214 .WillRepeatedly(Invoke( 214 .WillRepeatedly(InvokeWithoutArgs(
215 this, &DecryptingVideoDecoderTest::AbortPendingVideoDecodeCB)); 215 this, &DecryptingVideoDecoderTest::AbortPendingVideoDecodeCB));
216 216
217 decoder_->Reset(NewExpectedClosure()); 217 decoder_->Reset(NewExpectedClosure());
218 message_loop_.RunAllPending(); 218 message_loop_.RunAllPending();
219 } 219 }
220 220
221 void Stop() { 221 void Stop() {
222 EXPECT_CALL(*decryptor_, StopVideoDecoder()) 222 EXPECT_CALL(*decryptor_, DeinitializeDecoder(Decryptor::kVideo))
223 .WillRepeatedly(Invoke( 223 .WillRepeatedly(InvokeWithoutArgs(
224 this, &DecryptingVideoDecoderTest::AbortAllPendingCBs)); 224 this, &DecryptingVideoDecoderTest::AbortAllPendingCBs));
225 225
226 decoder_->Stop(NewExpectedClosure()); 226 decoder_->Stop(NewExpectedClosure());
227 message_loop_.RunAllPending(); 227 message_loop_.RunAllPending();
228 } 228 }
229 229
230 MOCK_METHOD1(RequestDecryptorNotification, 230 MOCK_METHOD1(RequestDecryptorNotification,
231 void(const DecryptingVideoDecoder::DecryptorNotificationCB&)); 231 void(const DecryptingVideoDecoder::DecryptorNotificationCB&));
232 232
233 MOCK_METHOD2(FrameReady, void(VideoDecoder::Status, 233 MOCK_METHOD2(FrameReady, void(VideoDecoder::Status,
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 Stop(); 531 Stop();
532 } 532 }
533 533
534 // Test stopping when there is a pending reset on the decoder. 534 // Test stopping when there is a pending reset on the decoder.
535 // Reset is pending because it cannot complete when the video decode callback 535 // Reset is pending because it cannot complete when the video decode callback
536 // is pending. 536 // is pending.
537 TEST_F(DecryptingVideoDecoderTest, Stop_DuringPendingReset) { 537 TEST_F(DecryptingVideoDecoderTest, Stop_DuringPendingReset) {
538 Initialize(); 538 Initialize();
539 EnterPendingDecodeState(); 539 EnterPendingDecodeState();
540 540
541 EXPECT_CALL(*decryptor_, CancelDecryptAndDecodeVideo()); 541 EXPECT_CALL(*decryptor_, ResetDecoder(Decryptor::kVideo));
542 EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull())); 542 EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull()));
543 543
544 decoder_->Reset(NewExpectedClosure()); 544 decoder_->Reset(NewExpectedClosure());
545 Stop(); 545 Stop();
546 } 546 }
547 547
548 // Test stopping after the decoder has been reset. 548 // Test stopping after the decoder has been reset.
549 TEST_F(DecryptingVideoDecoderTest, Stop_AfterReset) { 549 TEST_F(DecryptingVideoDecoderTest, Stop_AfterReset) {
550 Initialize(); 550 Initialize();
551 EnterNormalDecodingState(); 551 EnterNormalDecodingState();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 592
593 EXPECT_CALL(*demuxer_, Read(_)) 593 EXPECT_CALL(*demuxer_, Read(_))
594 .WillOnce(ReturnConfigChanged()); 594 .WillOnce(ReturnConfigChanged());
595 595
596 // TODO(xhwang): Update this test when kConfigChanged is supported in 596 // TODO(xhwang): Update this test when kConfigChanged is supported in
597 // DecryptingVideoDecoder. 597 // DecryptingVideoDecoder.
598 ReadAndExpectFrameReadyWith(VideoDecoder::kDecodeError, null_video_frame_); 598 ReadAndExpectFrameReadyWith(VideoDecoder::kDecodeError, null_video_frame_);
599 } 599 }
600 600
601 } // namespace media 601 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/decrypting_video_decoder.cc ('k') | media/filters/ffmpeg_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698