| 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/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "media/base/decoder_buffer.h" | 8 #include "media/base/decoder_buffer.h" |
| 9 #include "media/base/decrypt_config.h" | 9 #include "media/base/decrypt_config.h" |
| 10 #include "media/base/mock_filters.h" | 10 #include "media/base/mock_filters.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 const uint8 (&key)[KeySize]) { | 68 const uint8 (&key)[KeySize]) { |
| 69 EXPECT_CALL(client_, KeyAdded(kClearKeySystem, session_id_string_)); | 69 EXPECT_CALL(client_, KeyAdded(kClearKeySystem, session_id_string_)); |
| 70 decryptor_.AddKey(kClearKeySystem, key, KeySize, key_id, KeyIdSize, | 70 decryptor_.AddKey(kClearKeySystem, key, KeySize, key_id, KeyIdSize, |
| 71 session_id_string_); | 71 session_id_string_); |
| 72 } | 72 } |
| 73 | 73 |
| 74 template <int KeyIdSize, int KeySize> | 74 template <int KeyIdSize, int KeySize> |
| 75 void AddKeyAndExpectToFail(const uint8 (&key_id)[KeyIdSize], | 75 void AddKeyAndExpectToFail(const uint8 (&key_id)[KeyIdSize], |
| 76 const uint8 (&key)[KeySize]) { | 76 const uint8 (&key)[KeySize]) { |
| 77 EXPECT_CALL(client_, KeyError(kClearKeySystem, session_id_string_, | 77 EXPECT_CALL(client_, KeyError(kClearKeySystem, session_id_string_, |
| 78 AesDecryptor::kUnknownError, 0)); | 78 Decryptor::kUnknownError, 0)); |
| 79 decryptor_.AddKey(kClearKeySystem, key, KeySize, key_id, KeyIdSize, | 79 decryptor_.AddKey(kClearKeySystem, key, KeySize, key_id, KeyIdSize, |
| 80 session_id_string_); | 80 session_id_string_); |
| 81 } | 81 } |
| 82 | 82 |
| 83 template <int KeyIdSize> | 83 template <int KeyIdSize> |
| 84 void SetKeyIdForEncryptedData(const uint8 (&key_id)[KeyIdSize]) { | 84 void SetKeyIdForEncryptedData(const uint8 (&key_id)[KeyIdSize]) { |
| 85 encrypted_data_->SetDecryptConfig( | 85 encrypted_data_->SetDecryptConfig( |
| 86 scoped_ptr<DecryptConfig>(new DecryptConfig(key_id, KeyIdSize))); | 86 scoped_ptr<DecryptConfig>(new DecryptConfig(key_id, KeyIdSize))); |
| 87 } | 87 } |
| 88 | 88 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 AddKeyAndExpectToSucceed(kKeyId1, kRightKey); | 137 AddKeyAndExpectToSucceed(kKeyId1, kRightKey); |
| 138 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToSucceed()); | 138 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToSucceed()); |
| 139 } | 139 } |
| 140 | 140 |
| 141 TEST_F(AesDecryptorTest, WrongSizedKey) { | 141 TEST_F(AesDecryptorTest, WrongSizedKey) { |
| 142 GenerateKeyRequest(); | 142 GenerateKeyRequest(); |
| 143 AddKeyAndExpectToFail(kKeyId1, kWrongSizedKey); | 143 AddKeyAndExpectToFail(kKeyId1, kWrongSizedKey); |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // media | 146 } // media |
| OLD | NEW |