| OLD | NEW |
| 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 "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" |
| 11 #include "chrome/browser/autofill/credit_card.h" | 11 #include "chrome/browser/autofill/credit_card.h" |
| 12 #include "chrome/browser/autofill/field_types.h" | 12 #include "chrome/browser/autofill/field_types.h" |
| 13 #include "chrome/browser/sync/util/data_encryption.h" | 13 #include "chrome/browser/sync/util/data_encryption.h" |
| 14 #include "chrome/test/base/testing_browser_process_test.h" | |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 15 |
| 17 using base::win::RegKey; | 16 using base::win::RegKey; |
| 18 | 17 |
| 19 // Defined in autofill_ie_toolbar_import_win.cc. Not exposed in the header file. | 18 // Defined in autofill_ie_toolbar_import_win.cc. Not exposed in the header file. |
| 20 bool ImportCurrentUserProfiles(std::vector<AutofillProfile>* profiles, | 19 bool ImportCurrentUserProfiles(std::vector<AutofillProfile>* profiles, |
| 21 std::vector<CreditCard>* credit_cards); | 20 std::vector<CreditCard>* credit_cards); |
| 22 | 21 |
| 23 namespace { | 22 namespace { |
| 24 | 23 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 const ValueDescription* values, size_t values_size) { | 100 const ValueDescription* values, size_t values_size) { |
| 102 RegKey subkey; | 101 RegKey subkey; |
| 103 subkey.Create(key->Handle(), subkey_name, KEY_ALL_ACCESS); | 102 subkey.Create(key->Handle(), subkey_name, KEY_ALL_ACCESS); |
| 104 EXPECT_TRUE(subkey.Valid()); | 103 EXPECT_TRUE(subkey.Valid()); |
| 105 for (size_t i = 0; i < values_size; ++i) | 104 for (size_t i = 0; i < values_size; ++i) |
| 106 EncryptAndWrite(&subkey, values + i); | 105 EncryptAndWrite(&subkey, values + i); |
| 107 } | 106 } |
| 108 | 107 |
| 109 } // namespace | 108 } // namespace |
| 110 | 109 |
| 111 class AutofillIeToolbarImportTest : public TestingBrowserProcessTest { | 110 class AutofillIeToolbarImportTest : public testing::Test { |
| 112 public: | 111 public: |
| 113 AutofillIeToolbarImportTest(); | 112 AutofillIeToolbarImportTest(); |
| 114 | 113 |
| 115 // testing::Test method overrides: | 114 // testing::Test method overrides: |
| 116 virtual void SetUp(); | 115 virtual void SetUp(); |
| 117 virtual void TearDown(); | 116 virtual void TearDown(); |
| 118 | 117 |
| 119 private: | 118 private: |
| 120 RegKey temp_hkcu_hive_key_; | 119 RegKey temp_hkcu_hive_key_; |
| 121 | 120 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 199 |
| 201 profiles.clear(); | 200 profiles.clear(); |
| 202 credit_cards.clear(); | 201 credit_cards.clear(); |
| 203 EXPECT_TRUE(ImportCurrentUserProfiles(&profiles, &credit_cards)); | 202 EXPECT_TRUE(ImportCurrentUserProfiles(&profiles, &credit_cards)); |
| 204 // Profiles are not protected. | 203 // Profiles are not protected. |
| 205 EXPECT_EQ(2U, profiles.size()); | 204 EXPECT_EQ(2U, profiles.size()); |
| 206 // Credit cards are. | 205 // Credit cards are. |
| 207 EXPECT_EQ(0U, credit_cards.size()); | 206 EXPECT_EQ(0U, credit_cards.size()); |
| 208 } | 207 } |
| 209 | 208 |
| OLD | NEW |