| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 return result; | 78 return result; |
| 79 } | 79 } |
| 80 | 80 |
| 81 class PersonalDataManagerMock : public PersonalDataManager { | 81 class PersonalDataManagerMock : public PersonalDataManager { |
| 82 public: | 82 public: |
| 83 PersonalDataManagerMock(); | 83 PersonalDataManagerMock(); |
| 84 virtual ~PersonalDataManagerMock(); | 84 ~PersonalDataManagerMock() override; |
| 85 | 85 |
| 86 // Reset the saved profiles. | 86 // Reset the saved profiles. |
| 87 void Reset(); | 87 void Reset(); |
| 88 | 88 |
| 89 // PersonalDataManager: | 89 // PersonalDataManager: |
| 90 virtual std::string SaveImportedProfile( | 90 std::string SaveImportedProfile(const AutofillProfile& profile) override; |
| 91 const AutofillProfile& profile) override; | 91 const std::vector<AutofillProfile*>& web_profiles() const override; |
| 92 virtual const std::vector<AutofillProfile*>& web_profiles() const override; | |
| 93 | 92 |
| 94 private: | 93 private: |
| 95 ScopedVector<AutofillProfile> profiles_; | 94 ScopedVector<AutofillProfile> profiles_; |
| 96 | 95 |
| 97 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerMock); | 96 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerMock); |
| 98 }; | 97 }; |
| 99 | 98 |
| 100 PersonalDataManagerMock::PersonalDataManagerMock() | 99 PersonalDataManagerMock::PersonalDataManagerMock() |
| 101 : PersonalDataManager("en-US") { | 100 : PersonalDataManager("en-US") { |
| 102 } | 101 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 133 class AutofillMergeTest : public testing::Test, | 132 class AutofillMergeTest : public testing::Test, |
| 134 public DataDrivenTest { | 133 public DataDrivenTest { |
| 135 protected: | 134 protected: |
| 136 AutofillMergeTest(); | 135 AutofillMergeTest(); |
| 137 virtual ~AutofillMergeTest(); | 136 virtual ~AutofillMergeTest(); |
| 138 | 137 |
| 139 // testing::Test: | 138 // testing::Test: |
| 140 virtual void SetUp(); | 139 virtual void SetUp(); |
| 141 | 140 |
| 142 // DataDrivenTest: | 141 // DataDrivenTest: |
| 143 virtual void GenerateResults(const std::string& input, | 142 void GenerateResults(const std::string& input, std::string* output) override; |
| 144 std::string* output) override; | |
| 145 | 143 |
| 146 // Deserializes a set of Autofill profiles from |profiles|, imports each | 144 // Deserializes a set of Autofill profiles from |profiles|, imports each |
| 147 // sequentially, and fills |merged_profiles| with the serialized result. | 145 // sequentially, and fills |merged_profiles| with the serialized result. |
| 148 void MergeProfiles(const std::string& profiles, std::string* merged_profiles); | 146 void MergeProfiles(const std::string& profiles, std::string* merged_profiles); |
| 149 | 147 |
| 150 // Deserializes |str| into a field type. | 148 // Deserializes |str| into a field type. |
| 151 ServerFieldType StringToFieldType(const std::string& str); | 149 ServerFieldType StringToFieldType(const std::string& str); |
| 152 | 150 |
| 153 PersonalDataManagerMock personal_data_; | 151 PersonalDataManagerMock personal_data_; |
| 154 | 152 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 ServerFieldType AutofillMergeTest::StringToFieldType(const std::string& str) { | 241 ServerFieldType AutofillMergeTest::StringToFieldType(const std::string& str) { |
| 244 return string_to_field_type_map_[str]; | 242 return string_to_field_type_map_[str]; |
| 245 } | 243 } |
| 246 | 244 |
| 247 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { | 245 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { |
| 248 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), | 246 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), |
| 249 kFileNamePattern); | 247 kFileNamePattern); |
| 250 } | 248 } |
| 251 | 249 |
| 252 } // namespace autofill | 250 } // namespace autofill |
| OLD | NEW |