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

Side by Side Diff: chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc

Issue 11421047: sync: Move data_encryption_win.h into syncer namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittests Created 8 years 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
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 "chrome/browser/autofill/autofill_ie_toolbar_import_win.h" 5 #include "chrome/browser/autofill/autofill_ie_toolbar_import_win.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/win/registry.h" 9 #include "base/win/registry.h"
10 #include "chrome/browser/autofill/autofill_profile.h" 10 #include "chrome/browser/autofill/autofill_profile.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 ValueDescription protected_salt = { 77 ValueDescription protected_salt = {
78 L"salt", L"\x4854\xB906\x9C7C\x50A6\x4376\xFD9D\x1E02" 78 L"salt", L"\x4854\xB906\x9C7C\x50A6\x4376\xFD9D\x1E02"
79 }; 79 };
80 80
81 ValueDescription protected_password = { 81 ValueDescription protected_password = {
82 L"password_hash", L"\x18B7\xE586\x459B\x7457\xA066\x3842\x71DA" 82 L"password_hash", L"\x18B7\xE586\x459B\x7457\xA066\x3842\x71DA"
83 }; 83 };
84 84
85 void EncryptAndWrite(RegKey* key, const ValueDescription* value) { 85 void EncryptAndWrite(RegKey* key, const ValueDescription* value) {
86 string data; 86 std::string data;
87 size_t data_size = (lstrlen(value->value) + 1) * sizeof(wchar_t); 87 size_t data_size = (lstrlen(value->value) + 1) * sizeof(wchar_t);
88 data.resize(data_size); 88 data.resize(data_size);
89 memcpy(&data[0], value->value, data_size); 89 memcpy(&data[0], value->value, data_size);
90 90
91 std::vector<uint8> encrypted_data = EncryptData(data); 91 std::vector<uint8> encrypted_data = syncer::EncryptData(data);
92 EXPECT_EQ(ERROR_SUCCESS, key->WriteValue(value->value_name, 92 EXPECT_EQ(ERROR_SUCCESS, key->WriteValue(value->value_name,
93 &encrypted_data[0], encrypted_data.size(), REG_BINARY)); 93 &encrypted_data[0], encrypted_data.size(), REG_BINARY));
94 } 94 }
95 95
96 void CreateSubkey(RegKey* key, wchar_t const* subkey_name, 96 void CreateSubkey(RegKey* key, wchar_t const* subkey_name,
97 const ValueDescription* values, size_t values_size) { 97 const ValueDescription* values, size_t values_size) {
98 RegKey subkey; 98 RegKey subkey;
99 subkey.Create(key->Handle(), subkey_name, KEY_ALL_ACCESS); 99 subkey.Create(key->Handle(), subkey_name, KEY_ALL_ACCESS);
100 EXPECT_TRUE(subkey.Valid()); 100 EXPECT_TRUE(subkey.Valid());
101 for (size_t i = 0; i < values_size; ++i) 101 for (size_t i = 0; i < values_size; ++i)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 profiles.clear(); 195 profiles.clear();
196 credit_cards.clear(); 196 credit_cards.clear();
197 EXPECT_TRUE(ImportCurrentUserProfiles(&profiles, &credit_cards)); 197 EXPECT_TRUE(ImportCurrentUserProfiles(&profiles, &credit_cards));
198 // Profiles are not protected. 198 // Profiles are not protected.
199 EXPECT_EQ(2U, profiles.size()); 199 EXPECT_EQ(2U, profiles.size());
200 // Credit cards are. 200 // Credit cards are.
201 EXPECT_EQ(0U, credit_cards.size()); 201 EXPECT_EQ(0U, credit_cards.size());
202 } 202 }
203 203
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_ie_toolbar_import_win.cc ('k') | sync/util/data_encryption_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698