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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 267 } |
268 | 268 |
269 void AddKeyAndExpectToFail(const uint8* key_id, int key_id_size, | 269 void AddKeyAndExpectToFail(const uint8* key_id, int key_id_size, |
270 const uint8* key, int key_size) { | 270 const uint8* key, int key_size) { |
271 EXPECT_CALL(client_, KeyError(kClearKeySystem, session_id_string_, | 271 EXPECT_CALL(client_, KeyError(kClearKeySystem, session_id_string_, |
272 Decryptor::kUnknownError, 0)); | 272 Decryptor::kUnknownError, 0)); |
273 decryptor_.AddKey(kClearKeySystem, key, key_size, key_id, key_id_size, | 273 decryptor_.AddKey(kClearKeySystem, key, key_size, key_id, key_id_size, |
274 session_id_string_); | 274 session_id_string_); |
275 } | 275 } |
276 | 276 |
277 MOCK_METHOD2(BufferDecrypted, void(Decryptor::DecryptStatus, | 277 MOCK_METHOD2(BufferDecrypted, void(Decryptor::Status, |
278 const scoped_refptr<DecoderBuffer>&)); | 278 const scoped_refptr<DecoderBuffer>&)); |
279 | 279 |
280 void DecryptAndExpectToSucceed(const scoped_refptr<DecoderBuffer>& encrypted, | 280 void DecryptAndExpectToSucceed(const scoped_refptr<DecoderBuffer>& encrypted, |
281 const uint8* plain_text, int plain_text_size) { | 281 const uint8* plain_text, int plain_text_size) { |
282 scoped_refptr<DecoderBuffer> decrypted; | 282 scoped_refptr<DecoderBuffer> decrypted; |
283 EXPECT_CALL(*this, BufferDecrypted(AesDecryptor::kSuccess, NotNull())) | 283 EXPECT_CALL(*this, BufferDecrypted(AesDecryptor::kSuccess, NotNull())) |
284 .WillOnce(SaveArg<1>(&decrypted)); | 284 .WillOnce(SaveArg<1>(&decrypted)); |
285 | 285 |
286 decryptor_.Decrypt(encrypted, decrypt_cb_); | 286 decryptor_.Decrypt(encrypted, decrypt_cb_); |
287 ASSERT_TRUE(decrypted); | 287 ASSERT_TRUE(decrypted); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 scoped_refptr<DecoderBuffer> encrypted_data = CreateSubsampleEncryptedBuffer( | 573 scoped_refptr<DecoderBuffer> encrypted_data = CreateSubsampleEncryptedBuffer( |
574 kSubsampleData, arraysize(kSubsampleData), | 574 kSubsampleData, arraysize(kSubsampleData), |
575 kSubsampleKeyId, arraysize(kSubsampleKeyId), | 575 kSubsampleKeyId, arraysize(kSubsampleKeyId), |
576 kSubsampleIv, arraysize(kSubsampleIv), | 576 kSubsampleIv, arraysize(kSubsampleIv), |
577 0, | 577 0, |
578 entries); | 578 entries); |
579 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToFail(encrypted_data)); | 579 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToFail(encrypted_data)); |
580 } | 580 } |
581 | 581 |
582 } // namespace media | 582 } // namespace media |
OLD | NEW |