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

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

Issue 6090006: Regkey functions return error code instead of bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 L"password_hash", L"\x18B7\xE586\x459B\x7457\xA066\x3842\x71DA" 85 L"password_hash", L"\x18B7\xE586\x459B\x7457\xA066\x3842\x71DA"
86 }; 86 };
87 87
88 void EncryptAndWrite(RegKey* key, const ValueDescription* value) { 88 void EncryptAndWrite(RegKey* key, const ValueDescription* value) {
89 string data; 89 string data;
90 size_t data_size = (lstrlen(value->value) + 1) * sizeof(wchar_t); 90 size_t data_size = (lstrlen(value->value) + 1) * sizeof(wchar_t);
91 data.resize(data_size); 91 data.resize(data_size);
92 memcpy(&data[0], value->value, data_size); 92 memcpy(&data[0], value->value, data_size);
93 93
94 std::vector<uint8> encrypted_data = EncryptData(data); 94 std::vector<uint8> encrypted_data = EncryptData(data);
95 EXPECT_TRUE(key->WriteValue(value->value_name, &encrypted_data[0], 95 EXPECT_EQ(ERROR_SUCCESS, key->WriteValue(value->value_name,
96 encrypted_data.size(), REG_BINARY)); 96 &encrypted_data[0], encrypted_data.size(), REG_BINARY));
97 } 97 }
98 98
99 void CreateSubkey(RegKey* key, wchar_t const* subkey_name, 99 void CreateSubkey(RegKey* key, wchar_t const* subkey_name,
100 const ValueDescription* values, size_t values_size) { 100 const ValueDescription* values, size_t values_size) {
101 RegKey subkey; 101 RegKey subkey;
102 subkey.Create(key->Handle(), subkey_name, KEY_ALL_ACCESS); 102 subkey.Create(key->Handle(), subkey_name, KEY_ALL_ACCESS);
103 EXPECT_TRUE(subkey.Valid()); 103 EXPECT_TRUE(subkey.Valid());
104 for (size_t i = 0; i < values_size; ++i) 104 for (size_t i = 0; i < values_size; ++i)
105 EncryptAndWrite(&subkey, values + i); 105 EncryptAndWrite(&subkey, values + i);
106 } 106 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 profiles.clear(); 220 profiles.clear();
221 credit_cards.clear(); 221 credit_cards.clear();
222 EXPECT_TRUE(ImportCurrentUserProfiles(&profiles, &credit_cards)); 222 EXPECT_TRUE(ImportCurrentUserProfiles(&profiles, &credit_cards));
223 // Profiles are not protected. 223 // Profiles are not protected.
224 EXPECT_EQ(profiles.size(), 2); 224 EXPECT_EQ(profiles.size(), 2);
225 // Credit cards are. 225 // Credit cards are.
226 EXPECT_EQ(credit_cards.size(), 0); 226 EXPECT_EQ(credit_cards.size(), 0);
227 } 227 }
228 228
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_ie_toolbar_import_win.cc ('k') | chrome/browser/background_mode_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698