| 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 #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/message_loop.h" | 10 #include "base/message_loop/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/gmock_callback_support.h" | 13 #include "media/base/gmock_callback_support.h" |
| 14 #include "media/base/mock_filters.h" | 14 #include "media/base/mock_filters.h" |
| 15 #include "media/base/test_helpers.h" | 15 #include "media/base/test_helpers.h" |
| 16 #include "media/base/video_frame.h" | 16 #include "media/base/video_frame.h" |
| 17 #include "media/filters/decrypting_video_decoder.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::Invoke; | 21 using ::testing::Invoke; |
| 22 using ::testing::Return; | 22 using ::testing::Return; |
| 23 using ::testing::SaveArg; | 23 using ::testing::SaveArg; |
| 24 using ::testing::StrictMock; | 24 using ::testing::StrictMock; |
| 25 | 25 |
| 26 namespace media { | 26 namespace media { |
| 27 | 27 |
| 28 const uint8 kFakeKeyId[] = { 0x4b, 0x65, 0x79, 0x20, 0x49, 0x44 }; | 28 const uint8_t kFakeKeyId[] = {0x4b, 0x65, 0x79, 0x20, 0x49, 0x44}; |
| 29 const uint8 kFakeIv[DecryptConfig::kDecryptionKeySize] = { 0 }; | 29 const uint8_t kFakeIv[DecryptConfig::kDecryptionKeySize] = {0}; |
| 30 const int kDecodingDelay = 3; | 30 const int kDecodingDelay = 3; |
| 31 | 31 |
| 32 // Create a fake non-empty encrypted buffer. | 32 // Create a fake non-empty encrypted buffer. |
| 33 static scoped_refptr<DecoderBuffer> CreateFakeEncryptedBuffer() { | 33 static scoped_refptr<DecoderBuffer> CreateFakeEncryptedBuffer() { |
| 34 const int buffer_size = 16; // Need a non-empty buffer; | 34 const int buffer_size = 16; // Need a non-empty buffer; |
| 35 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(buffer_size)); | 35 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(buffer_size)); |
| 36 buffer->set_decrypt_config(scoped_ptr<DecryptConfig>(new DecryptConfig( | 36 buffer->set_decrypt_config(scoped_ptr<DecryptConfig>(new DecryptConfig( |
| 37 std::string(reinterpret_cast<const char*>(kFakeKeyId), | 37 std::string(reinterpret_cast<const char*>(kFakeKeyId), |
| 38 arraysize(kFakeKeyId)), | 38 arraysize(kFakeKeyId)), |
| 39 std::string(reinterpret_cast<const char*>(kFakeIv), arraysize(kFakeIv)), | 39 std::string(reinterpret_cast<const char*>(kFakeIv), arraysize(kFakeIv)), |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 524 |
| 525 // Test destruction after the decoder has been reset. | 525 // Test destruction after the decoder has been reset. |
| 526 TEST_F(DecryptingVideoDecoderTest, Destroy_AfterReset) { | 526 TEST_F(DecryptingVideoDecoderTest, Destroy_AfterReset) { |
| 527 Initialize(); | 527 Initialize(); |
| 528 EnterNormalDecodingState(); | 528 EnterNormalDecodingState(); |
| 529 Reset(); | 529 Reset(); |
| 530 Destroy(); | 530 Destroy(); |
| 531 } | 531 } |
| 532 | 532 |
| 533 } // namespace media | 533 } // namespace media |
| OLD | NEW |