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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 base::Unretained(this))), | 249 base::Unretained(this))), |
250 subsample_entries_(kSubsampleEntries, | 250 subsample_entries_(kSubsampleEntries, |
251 kSubsampleEntries + arraysize(kSubsampleEntries)) { | 251 kSubsampleEntries + arraysize(kSubsampleEntries)) { |
252 } | 252 } |
253 | 253 |
254 protected: | 254 protected: |
255 void GenerateKeyRequest(const uint8* key_id, int key_id_size) { | 255 void GenerateKeyRequest(const uint8* key_id, int key_id_size) { |
256 EXPECT_CALL(client_, KeyMessageMock(kClearKeySystem, StrNe(std::string()), | 256 EXPECT_CALL(client_, KeyMessageMock(kClearKeySystem, StrNe(std::string()), |
257 NotNull(), Gt(0), "")) | 257 NotNull(), Gt(0), "")) |
258 .WillOnce(SaveArg<1>(&session_id_string_)); | 258 .WillOnce(SaveArg<1>(&session_id_string_)); |
259 decryptor_.GenerateKeyRequest(kClearKeySystem, key_id, key_id_size); | 259 EXPECT_TRUE(decryptor_.GenerateKeyRequest(kClearKeySystem, |
| 260 key_id, key_id_size)); |
260 } | 261 } |
261 | 262 |
262 void AddKeyAndExpectToSucceed(const uint8* key_id, int key_id_size, | 263 void AddKeyAndExpectToSucceed(const uint8* key_id, int key_id_size, |
263 const uint8* key, int key_size) { | 264 const uint8* key, int key_size) { |
264 EXPECT_CALL(client_, KeyAdded(kClearKeySystem, session_id_string_)); | 265 EXPECT_CALL(client_, KeyAdded(kClearKeySystem, session_id_string_)); |
265 decryptor_.AddKey(kClearKeySystem, key, key_size, key_id, key_id_size, | 266 decryptor_.AddKey(kClearKeySystem, key, key_size, key_id, key_id_size, |
266 session_id_string_); | 267 session_id_string_); |
267 } | 268 } |
268 | 269 |
269 void AddKeyAndExpectToFail(const uint8* key_id, int key_id_size, | 270 void AddKeyAndExpectToFail(const uint8* key_id, int key_id_size, |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 scoped_refptr<DecoderBuffer> encrypted_data = CreateSubsampleEncryptedBuffer( | 574 scoped_refptr<DecoderBuffer> encrypted_data = CreateSubsampleEncryptedBuffer( |
574 kSubsampleData, arraysize(kSubsampleData), | 575 kSubsampleData, arraysize(kSubsampleData), |
575 kSubsampleKeyId, arraysize(kSubsampleKeyId), | 576 kSubsampleKeyId, arraysize(kSubsampleKeyId), |
576 kSubsampleIv, arraysize(kSubsampleIv), | 577 kSubsampleIv, arraysize(kSubsampleIv), |
577 0, | 578 0, |
578 entries); | 579 entries); |
579 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToFail(encrypted_data)); | 580 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToFail(encrypted_data)); |
580 } | 581 } |
581 | 582 |
582 } // namespace media | 583 } // namespace media |
OLD | NEW |