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

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

Issue 9854031: Replace size_t with int in a few media classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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/base/seekable_buffer_unittest.cc ('k') | media/filters/audio_renderer_algorithm_base.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 "media/base/data_buffer.h" 7 #include "media/base/data_buffer.h"
8 #include "media/base/decrypt_config.h" 8 #include "media/base/decrypt_config.h"
9 #include "media/crypto/aes_decryptor.h" 9 #include "media/crypto/aes_decryptor.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 22 matching lines...) Expand all
33 33
34 protected: 34 protected:
35 void SetKeyIdForEncryptedData(const uint8* key_id, int key_id_size) { 35 void SetKeyIdForEncryptedData(const uint8* key_id, int key_id_size) {
36 encrypted_data_->SetDecryptConfig( 36 encrypted_data_->SetDecryptConfig(
37 scoped_ptr<DecryptConfig>(new DecryptConfig(key_id, key_id_size))); 37 scoped_ptr<DecryptConfig>(new DecryptConfig(key_id, key_id_size)));
38 } 38 }
39 39
40 void DecryptAndExpectToSucceed() { 40 void DecryptAndExpectToSucceed() {
41 scoped_refptr<Buffer> decrypted = decryptor_.Decrypt(encrypted_data_); 41 scoped_refptr<Buffer> decrypted = decryptor_.Decrypt(encrypted_data_);
42 ASSERT_TRUE(decrypted); 42 ASSERT_TRUE(decrypted);
43 size_t data_length = sizeof(kOriginalData) - 1; 43 int data_length = sizeof(kOriginalData) - 1;
44 ASSERT_EQ(data_length, decrypted->GetDataSize()); 44 ASSERT_EQ(data_length, decrypted->GetDataSize());
45 EXPECT_EQ(0, memcmp(kOriginalData, decrypted->GetData(), data_length)); 45 EXPECT_EQ(0, memcmp(kOriginalData, decrypted->GetData(), data_length));
46 } 46 }
47 47
48 void DecryptAndExpectToFail() { 48 void DecryptAndExpectToFail() {
49 scoped_refptr<Buffer> decrypted = decryptor_.Decrypt(encrypted_data_); 49 scoped_refptr<Buffer> decrypted = decryptor_.Decrypt(encrypted_data_);
50 EXPECT_FALSE(decrypted); 50 EXPECT_FALSE(decrypted);
51 } 51 }
52 52
53 scoped_refptr<DataBuffer> encrypted_data_; 53 scoped_refptr<DataBuffer> encrypted_data_;
(...skipping 21 matching lines...) Expand all
75 75
76 TEST_F(AesDecryptorTest, KeyReplacement) { 76 TEST_F(AesDecryptorTest, KeyReplacement) {
77 SetKeyIdForEncryptedData(kKeyId1, kKeyIdSize); 77 SetKeyIdForEncryptedData(kKeyId1, kKeyIdSize);
78 decryptor_.AddKey(kKeyId1, kKeyIdSize, kWrongKey, kKeySize); 78 decryptor_.AddKey(kKeyId1, kKeyIdSize, kWrongKey, kKeySize);
79 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToFail()); 79 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToFail());
80 decryptor_.AddKey(kKeyId1, kKeyIdSize, kRightKey, kKeySize); 80 decryptor_.AddKey(kKeyId1, kKeyIdSize, kRightKey, kKeySize);
81 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToSucceed()); 81 ASSERT_NO_FATAL_FAILURE(DecryptAndExpectToSucceed());
82 } 82 }
83 83
84 } // media 84 } // media
OLDNEW
« no previous file with comments | « media/base/seekable_buffer_unittest.cc ('k') | media/filters/audio_renderer_algorithm_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698