| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 subsample_entries))); | 223 subsample_entries))); |
| 224 return encrypted_buffer; | 224 return encrypted_buffer; |
| 225 } | 225 } |
| 226 | 226 |
| 227 class AesDecryptorTest : public testing::Test { | 227 class AesDecryptorTest : public testing::Test { |
| 228 public: | 228 public: |
| 229 AesDecryptorTest() | 229 AesDecryptorTest() |
| 230 : decryptor_( | 230 : decryptor_( |
| 231 base::Bind(&AesDecryptorTest::KeyAdded, base::Unretained(this)), | 231 base::Bind(&AesDecryptorTest::KeyAdded, base::Unretained(this)), |
| 232 base::Bind(&AesDecryptorTest::KeyError, base::Unretained(this)), | 232 base::Bind(&AesDecryptorTest::KeyError, base::Unretained(this)), |
| 233 base::Bind(&AesDecryptorTest::KeyMessage, base::Unretained(this)), | 233 base::Bind(&AesDecryptorTest::KeyMessage, base::Unretained(this))), |
| 234 NeedKeyCB()), | |
| 235 decrypt_cb_(base::Bind(&AesDecryptorTest::BufferDecrypted, | 234 decrypt_cb_(base::Bind(&AesDecryptorTest::BufferDecrypted, |
| 236 base::Unretained(this))), | 235 base::Unretained(this))), |
| 237 subsample_entries_(kSubsampleEntries, | 236 subsample_entries_(kSubsampleEntries, |
| 238 kSubsampleEntries + arraysize(kSubsampleEntries)) { | 237 kSubsampleEntries + arraysize(kSubsampleEntries)) { |
| 239 } | 238 } |
| 240 | 239 |
| 241 protected: | 240 protected: |
| 242 void GenerateKeyRequest(const uint8* key_id, int key_id_size) { | 241 void GenerateKeyRequest(const uint8* key_id, int key_id_size) { |
| 243 std::string key_id_string(reinterpret_cast<const char*>(key_id), | 242 std::string key_id_string(reinterpret_cast<const char*>(key_id), |
| 244 key_id_size); | 243 key_id_size); |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 scoped_refptr<DecoderBuffer> encrypted_data = CreateSubsampleEncryptedBuffer( | 594 scoped_refptr<DecoderBuffer> encrypted_data = CreateSubsampleEncryptedBuffer( |
| 596 kSubsampleData, arraysize(kSubsampleData), | 595 kSubsampleData, arraysize(kSubsampleData), |
| 597 kSubsampleKeyId, arraysize(kSubsampleKeyId), | 596 kSubsampleKeyId, arraysize(kSubsampleKeyId), |
| 598 kSubsampleIv, arraysize(kSubsampleIv), | 597 kSubsampleIv, arraysize(kSubsampleIv), |
| 599 0, | 598 0, |
| 600 entries); | 599 entries); |
| 601 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToFail(encrypted_data)); | 600 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToFail(encrypted_data)); |
| 602 } | 601 } |
| 603 | 602 |
| 604 } // namespace media | 603 } // namespace media |
| OLD | NEW |