| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 std::string(reinterpret_cast<const char*>(kFakeIv), arraysize(kFakeIv)), | 50 std::string(reinterpret_cast<const char*>(kFakeIv), arraysize(kFakeIv)), |
| 51 std::vector<SubsampleEntry>()))); | 51 std::vector<SubsampleEntry>()))); |
| 52 return buffer; | 52 return buffer; |
| 53 } | 53 } |
| 54 | 54 |
| 55 class DecryptingAudioDecoderTest : public testing::Test { | 55 class DecryptingAudioDecoderTest : public testing::Test { |
| 56 public: | 56 public: |
| 57 DecryptingAudioDecoderTest() | 57 DecryptingAudioDecoderTest() |
| 58 : decoder_(new DecryptingAudioDecoder( | 58 : decoder_(new DecryptingAudioDecoder( |
| 59 message_loop_.task_runner(), | 59 message_loop_.task_runner(), |
| 60 new MediaLog(), | 60 &media_log_, |
| 61 base::Bind(&DecryptingAudioDecoderTest::OnWaitingForDecryptionKey, | 61 base::Bind(&DecryptingAudioDecoderTest::OnWaitingForDecryptionKey, |
| 62 base::Unretained(this)))), | 62 base::Unretained(this)))), |
| 63 cdm_context_(new StrictMock<MockCdmContext>()), | 63 cdm_context_(new StrictMock<MockCdmContext>()), |
| 64 decryptor_(new StrictMock<MockDecryptor>()), | 64 decryptor_(new StrictMock<MockDecryptor>()), |
| 65 num_decrypt_and_decode_calls_(0), | 65 num_decrypt_and_decode_calls_(0), |
| 66 num_frames_in_decryptor_(0), | 66 num_frames_in_decryptor_(0), |
| 67 encrypted_buffer_(CreateFakeEncryptedBuffer()), | 67 encrypted_buffer_(CreateFakeEncryptedBuffer()), |
| 68 decoded_frame_(NULL), | 68 decoded_frame_(NULL), |
| 69 decoded_frame_list_() {} | 69 decoded_frame_list_() {} |
| 70 | 70 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 decoder_.reset(); | 239 decoder_.reset(); |
| 240 base::RunLoop().RunUntilIdle(); | 240 base::RunLoop().RunUntilIdle(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 MOCK_METHOD1(FrameReady, void(const scoped_refptr<AudioBuffer>&)); | 243 MOCK_METHOD1(FrameReady, void(const scoped_refptr<AudioBuffer>&)); |
| 244 MOCK_METHOD1(DecodeDone, void(DecodeStatus)); | 244 MOCK_METHOD1(DecodeDone, void(DecodeStatus)); |
| 245 | 245 |
| 246 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); | 246 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); |
| 247 | 247 |
| 248 base::MessageLoop message_loop_; | 248 base::MessageLoop message_loop_; |
| 249 MediaLog media_log_; |
| 249 std::unique_ptr<DecryptingAudioDecoder> decoder_; | 250 std::unique_ptr<DecryptingAudioDecoder> decoder_; |
| 250 std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_; | 251 std::unique_ptr<StrictMock<MockCdmContext>> cdm_context_; |
| 251 std::unique_ptr<StrictMock<MockDecryptor>> decryptor_; | 252 std::unique_ptr<StrictMock<MockDecryptor>> decryptor_; |
| 252 AudioDecoderConfig config_; | 253 AudioDecoderConfig config_; |
| 253 | 254 |
| 254 // Variables to help the |decryptor_| to simulate decoding delay and flushing. | 255 // Variables to help the |decryptor_| to simulate decoding delay and flushing. |
| 255 int num_decrypt_and_decode_calls_; | 256 int num_decrypt_and_decode_calls_; |
| 256 int num_frames_in_decryptor_; | 257 int num_frames_in_decryptor_; |
| 257 | 258 |
| 258 Decryptor::DecoderInitCB pending_init_cb_; | 259 Decryptor::DecoderInitCB pending_init_cb_; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 | 473 |
| 473 // Test resetting after the decoder has been reset. | 474 // Test resetting after the decoder has been reset. |
| 474 TEST_F(DecryptingAudioDecoderTest, Reset_AfterReset) { | 475 TEST_F(DecryptingAudioDecoderTest, Reset_AfterReset) { |
| 475 Initialize(); | 476 Initialize(); |
| 476 EnterNormalDecodingState(); | 477 EnterNormalDecodingState(); |
| 477 Reset(); | 478 Reset(); |
| 478 Reset(); | 479 Reset(); |
| 479 } | 480 } |
| 480 | 481 |
| 481 } // namespace media | 482 } // namespace media |
| OLD | NEW |