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 "media/base/decoder_buffer.h" | 10 #include "media/base/decoder_buffer.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 AesDecryptorTest() | 233 AesDecryptorTest() |
234 : decryptor_(&client_), | 234 : decryptor_(&client_), |
235 decrypt_cb_(base::Bind(&AesDecryptorTest::BufferDecrypted, | 235 decrypt_cb_(base::Bind(&AesDecryptorTest::BufferDecrypted, |
236 base::Unretained(this))), | 236 base::Unretained(this))), |
237 subsample_entries_(kSubsampleEntries, | 237 subsample_entries_(kSubsampleEntries, |
238 kSubsampleEntries + arraysize(kSubsampleEntries)) { | 238 kSubsampleEntries + arraysize(kSubsampleEntries)) { |
239 } | 239 } |
240 | 240 |
241 protected: | 241 protected: |
242 void GenerateKeyRequest(const uint8* key_id, int key_id_size) { | 242 void GenerateKeyRequest(const uint8* key_id, int key_id_size) { |
243 EXPECT_CALL(client_, KeyMessageMock(kClearKeySystem, StrNe(std::string()), | 243 EXPECT_CALL(client_, KeyMessageMock(kClearKeySystem, StrNe(""), |
244 NotNull(), Gt(0), "")) | 244 NotNull(), Gt(0), "")) |
245 .WillOnce(SaveArg<1>(&session_id_string_)); | 245 .WillOnce(SaveArg<1>(&session_id_string_)); |
246 EXPECT_TRUE(decryptor_.GenerateKeyRequest(kClearKeySystem, | 246 EXPECT_TRUE(decryptor_.GenerateKeyRequest(kClearKeySystem, "", |
247 key_id, key_id_size)); | 247 key_id, key_id_size)); |
248 } | 248 } |
249 | 249 |
250 void AddKeyAndExpectToSucceed(const uint8* key_id, int key_id_size, | 250 void AddKeyAndExpectToSucceed(const uint8* key_id, int key_id_size, |
251 const uint8* key, int key_size) { | 251 const uint8* key, int key_size) { |
252 EXPECT_CALL(client_, KeyAdded(kClearKeySystem, session_id_string_)); | 252 EXPECT_CALL(client_, KeyAdded(kClearKeySystem, session_id_string_)); |
253 decryptor_.AddKey(kClearKeySystem, key, key_size, key_id, key_id_size, | 253 decryptor_.AddKey(kClearKeySystem, key, key_size, key_id, key_id_size, |
254 session_id_string_); | 254 session_id_string_); |
255 } | 255 } |
256 | 256 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 scoped_refptr<DecoderBuffer> encrypted_data = CreateSubsampleEncryptedBuffer( | 582 scoped_refptr<DecoderBuffer> encrypted_data = CreateSubsampleEncryptedBuffer( |
583 kSubsampleData, arraysize(kSubsampleData), | 583 kSubsampleData, arraysize(kSubsampleData), |
584 kSubsampleKeyId, arraysize(kSubsampleKeyId), | 584 kSubsampleKeyId, arraysize(kSubsampleKeyId), |
585 kSubsampleIv, arraysize(kSubsampleIv), | 585 kSubsampleIv, arraysize(kSubsampleIv), |
586 0, | 586 0, |
587 entries); | 587 entries); |
588 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToFail(encrypted_data)); | 588 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToFail(encrypted_data)); |
589 } | 589 } |
590 | 590 |
591 } // namespace media | 591 } // namespace media |
OLD | NEW |