OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <map> | 5 #include <map> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 PersonalDataManagerMock::~PersonalDataManagerMock() { | 104 PersonalDataManagerMock::~PersonalDataManagerMock() { |
105 } | 105 } |
106 | 106 |
107 void PersonalDataManagerMock::Reset() { | 107 void PersonalDataManagerMock::Reset() { |
108 profiles_.clear(); | 108 profiles_.clear(); |
109 } | 109 } |
110 | 110 |
111 void PersonalDataManagerMock::SaveImportedProfile( | 111 void PersonalDataManagerMock::SaveImportedProfile( |
112 const AutofillProfile& profile) { | 112 const AutofillProfile& profile) { |
113 std::vector<AutofillProfile> profiles; | 113 std::vector<AutofillProfile> profiles; |
114 if (!MergeProfile(profile, profiles_.get(), "en-US", &profiles)) | 114 std::string merged_guid = |
| 115 MergeProfile(profile, profiles_.get(), "en-US", &profiles); |
| 116 if (merged_guid != profile.guid()) |
115 profiles_.push_back(new AutofillProfile(profile)); | 117 profiles_.push_back(new AutofillProfile(profile)); |
116 } | 118 } |
117 | 119 |
118 const std::vector<AutofillProfile*>& PersonalDataManagerMock::web_profiles() | 120 const std::vector<AutofillProfile*>& PersonalDataManagerMock::web_profiles() |
119 const { | 121 const { |
120 return profiles_.get(); | 122 return profiles_.get(); |
121 } | 123 } |
122 | 124 |
123 } // namespace | 125 } // namespace |
124 | 126 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 ServerFieldType AutofillMergeTest::StringToFieldType(const std::string& str) { | 241 ServerFieldType AutofillMergeTest::StringToFieldType(const std::string& str) { |
240 return string_to_field_type_map_[str]; | 242 return string_to_field_type_map_[str]; |
241 } | 243 } |
242 | 244 |
243 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { | 245 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { |
244 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), | 246 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), |
245 kFileNamePattern); | 247 kFileNamePattern); |
246 } | 248 } |
247 | 249 |
248 } // namespace autofill | 250 } // namespace autofill |
OLD | NEW |