Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: media/crypto/aes_decryptor_unittest.cc

Issue 10539150: Add Decryptor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/crypto/aes_decryptor.cc ('k') | media/crypto/decryptor_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/crypto/aes_decryptor.cc ('k') | media/crypto/decryptor_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698