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

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

Issue 10896014: Add a bool return value to media::Decryptor::GenerateKeyRequest(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolve comments. Created 8 years, 3 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/filters/pipeline_integration_test.cc » ('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 #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
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
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
OLDNEW
« no previous file with comments | « media/crypto/aes_decryptor.cc ('k') | media/filters/pipeline_integration_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698