| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 virtual void SetUp(); | 121 virtual void SetUp(); |
| 122 | 122 |
| 123 // DataDrivenTest: | 123 // DataDrivenTest: |
| 124 virtual void GenerateResults(const std::string& input, | 124 virtual void GenerateResults(const std::string& input, |
| 125 std::string* output) OVERRIDE; | 125 std::string* output) OVERRIDE; |
| 126 | 126 |
| 127 // Deserializes a set of Autofill profiles from |profiles|, imports each | 127 // Deserializes a set of Autofill profiles from |profiles|, imports each |
| 128 // sequentially, and fills |merged_profiles| with the serialized result. | 128 // sequentially, and fills |merged_profiles| with the serialized result. |
| 129 void MergeProfiles(const std::string& profiles, std::string* merged_profiles); | 129 void MergeProfiles(const std::string& profiles, std::string* merged_profiles); |
| 130 | 130 |
| 131 scoped_refptr<PersonalDataManagerMock> personal_data_; | 131 scoped_ptr<PersonalDataManagerMock> personal_data_; |
| 132 | 132 |
| 133 private: | 133 private: |
| 134 DISALLOW_COPY_AND_ASSIGN(AutofillMergeTest); | 134 DISALLOW_COPY_AND_ASSIGN(AutofillMergeTest); |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 AutofillMergeTest::AutofillMergeTest() : DataDrivenTest() { | 137 AutofillMergeTest::AutofillMergeTest() : DataDrivenTest() { |
| 138 } | 138 } |
| 139 | 139 |
| 140 AutofillMergeTest::~AutofillMergeTest() { | 140 AutofillMergeTest::~AutofillMergeTest() { |
| 141 } | 141 } |
| 142 | 142 |
| 143 void AutofillMergeTest::SetUp() { | 143 void AutofillMergeTest::SetUp() { |
| 144 autofill_test::DisableSystemServices(NULL); | 144 autofill_test::DisableSystemServices(NULL); |
| 145 | 145 |
| 146 personal_data_ = new PersonalDataManagerMock(); | 146 personal_data_.reset(new PersonalDataManagerMock); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void AutofillMergeTest::GenerateResults(const std::string& input, | 149 void AutofillMergeTest::GenerateResults(const std::string& input, |
| 150 std::string* output) { | 150 std::string* output) { |
| 151 MergeProfiles(input, output); | 151 MergeProfiles(input, output); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void AutofillMergeTest::MergeProfiles(const std::string& profiles, | 154 void AutofillMergeTest::MergeProfiles(const std::string& profiles, |
| 155 std::string* merged_profiles) { | 155 std::string* merged_profiles) { |
| 156 // Start with no saved profiles. | 156 // Start with no saved profiles. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 *merged_profiles = SerializeProfiles(personal_data_->web_profiles()); | 213 *merged_profiles = SerializeProfiles(personal_data_->web_profiles()); |
| 214 } | 214 } |
| 215 | 215 |
| 216 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { | 216 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { |
| 217 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), | 217 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), |
| 218 kFileNamePattern); | 218 kFileNamePattern); |
| 219 } | 219 } |
| OLD | NEW |