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

Side by Side Diff: crypto/symmetric_key_unittest.cc

Issue 448853002: Move StringToLowerASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « content/shell/renderer/webkit_test_runner.cc ('k') | extensions/browser/extension_registry.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/symmetric_key.h" 5 #include "crypto/symmetric_key.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/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 crypto::SymmetricKey::DeriveKeyFromPassword( 93 crypto::SymmetricKey::DeriveKeyFromPassword(
94 test_data.algorithm, 94 test_data.algorithm,
95 test_data.password, test_data.salt, 95 test_data.password, test_data.salt,
96 test_data.rounds, test_data.key_size_in_bits)); 96 test_data.rounds, test_data.key_size_in_bits));
97 ASSERT_TRUE(NULL != key.get()); 97 ASSERT_TRUE(NULL != key.get());
98 98
99 std::string raw_key; 99 std::string raw_key;
100 key->GetRawKey(&raw_key); 100 key->GetRawKey(&raw_key);
101 EXPECT_EQ(test_data.key_size_in_bits / 8, raw_key.size()); 101 EXPECT_EQ(test_data.key_size_in_bits / 8, raw_key.size());
102 EXPECT_EQ(test_data.expected, 102 EXPECT_EQ(test_data.expected,
103 StringToLowerASCII(base::HexEncode(raw_key.data(), 103 base::StringToLowerASCII(base::HexEncode(raw_key.data(),
104 raw_key.size()))); 104 raw_key.size())));
105 } 105 }
106 106
107 static const PBKDF2TestVector kTestVectors[] = { 107 static const PBKDF2TestVector kTestVectors[] = {
108 // These tests come from 108 // These tests come from
109 // http://www.ietf.org/id/draft-josefsson-pbkdf2-test-vectors-00.txt 109 // http://www.ietf.org/id/draft-josefsson-pbkdf2-test-vectors-00.txt
110 { 110 {
111 crypto::SymmetricKey::HMAC_SHA1, 111 crypto::SymmetricKey::HMAC_SHA1,
112 "password", 112 "password",
113 "salt", 113 "salt",
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 216 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
217 "pass phrase exceeds block size", 217 "pass phrase exceeds block size",
218 20, 218 20,
219 256, 219 256,
220 "e0739745dc28b8721ba402e05214d2ac1eab54cf72bee1fba388297a09eb493c", 220 "e0739745dc28b8721ba402e05214d2ac1eab54cf72bee1fba388297a09eb493c",
221 }, 221 },
222 }; 222 };
223 223
224 INSTANTIATE_TEST_CASE_P(, SymmetricKeyDeriveKeyFromPasswordTest, 224 INSTANTIATE_TEST_CASE_P(, SymmetricKeyDeriveKeyFromPasswordTest,
225 testing::ValuesIn(kTestVectors)); 225 testing::ValuesIn(kTestVectors));
OLDNEW
« no previous file with comments | « content/shell/renderer/webkit_test_runner.cc ('k') | extensions/browser/extension_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698