| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Serializes the |profiles| into a string. | 46 // Serializes the |profiles| into a string. |
| 47 std::string SerializeProfiles(const std::vector<AutofillProfile*>& profiles) { | 47 std::string SerializeProfiles(const std::vector<AutofillProfile*>& profiles) { |
| 48 std::string result; | 48 std::string result; |
| 49 for (size_t i = 0; i < profiles.size(); ++i) { | 49 for (size_t i = 0; i < profiles.size(); ++i) { |
| 50 result += kProfileSeparator; | 50 result += kProfileSeparator; |
| 51 result += "\n"; | 51 result += "\n"; |
| 52 for (size_t j = 0; j < arraysize(kProfileFieldTypes); ++j) { | 52 for (size_t j = 0; j < arraysize(kProfileFieldTypes); ++j) { |
| 53 AutofillFieldType type = kProfileFieldTypes[j]; | 53 AutofillFieldType type = kProfileFieldTypes[j]; |
| 54 result += AutofillType::FieldTypeToString(type); | 54 result += AutofillType::FieldTypeToString(type); |
| 55 result += kFieldSeparator; | 55 result += kFieldSeparator; |
| 56 result += UTF16ToUTF8(profiles[i]->GetFieldText(AutofillType(type))); | 56 result += UTF16ToUTF8(profiles[i]->GetFieldText(type)); |
| 57 result += "\n"; | 57 result += "\n"; |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 return result; | 61 return result; |
| 62 } | 62 } |
| 63 | 63 |
| 64 class PersonalDataManagerMock : public PersonalDataManager { | 64 class PersonalDataManagerMock : public PersonalDataManager { |
| 65 public: | 65 public: |
| 66 PersonalDataManagerMock(); | 66 PersonalDataManagerMock(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| 216 *merged_profiles = SerializeProfiles(personal_data_->web_profiles()); | 216 *merged_profiles = SerializeProfiles(personal_data_->web_profiles()); |
| 217 } | 217 } |
| 218 | 218 |
| 219 TEST_F(AutoFillMergeTest, DataDrivenMergeProfiles) { | 219 TEST_F(AutoFillMergeTest, DataDrivenMergeProfiles) { |
| 220 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), | 220 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), |
| 221 kFileNamePattern); | 221 kFileNamePattern); |
| 222 } | 222 } |
| OLD | NEW |