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

Side by Side Diff: crypto/encryptor_unittest.cc

Issue 16123026: Use a direct include of strings headers in crypto/, dbus/, device/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « crypto/encryptor_openssl.cc ('k') | crypto/nss_util.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 "crypto/encryptor.h" 5 #include "crypto/encryptor.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "crypto/symmetric_key.h" 11 #include "crypto/symmetric_key.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 TEST(EncryptorTest, EncryptDecrypt) { 14 TEST(EncryptorTest, EncryptDecrypt) {
15 scoped_ptr<crypto::SymmetricKey> key( 15 scoped_ptr<crypto::SymmetricKey> key(
16 crypto::SymmetricKey::DeriveKeyFromPassword( 16 crypto::SymmetricKey::DeriveKeyFromPassword(
17 crypto::SymmetricKey::AES, "password", "saltiest", 1000, 256)); 17 crypto::SymmetricKey::AES, "password", "saltiest", 1000, 256));
18 EXPECT_TRUE(NULL != key.get()); 18 EXPECT_TRUE(NULL != key.get());
19 19
20 crypto::Encryptor encryptor; 20 crypto::Encryptor encryptor;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 crypto::Encryptor encryptor; 361 crypto::Encryptor encryptor;
362 // The IV must be exactly as long a the cipher block size. 362 // The IV must be exactly as long a the cipher block size.
363 EXPECT_EQ(16U, iv.size()); 363 EXPECT_EQ(16U, iv.size());
364 EXPECT_TRUE(encryptor.Init(sym_key.get(), crypto::Encryptor::CBC, iv)); 364 EXPECT_TRUE(encryptor.Init(sym_key.get(), crypto::Encryptor::CBC, iv));
365 365
366 std::string ciphertext; 366 std::string ciphertext;
367 EXPECT_TRUE(encryptor.Encrypt(plaintext, &ciphertext)); 367 EXPECT_TRUE(encryptor.Encrypt(plaintext, &ciphertext));
368 EXPECT_EQ(expected_ciphertext_hex, base::HexEncode(ciphertext.data(), 368 EXPECT_EQ(expected_ciphertext_hex, base::HexEncode(ciphertext.data(),
369 ciphertext.size())); 369 ciphertext.size()));
370 } 370 }
OLDNEW
« no previous file with comments | « crypto/encryptor_openssl.cc ('k') | crypto/nss_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698