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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 std::string SerializeProfiles(const std::vector<AutofillProfile*>& profiles) { | 60 std::string SerializeProfiles(const std::vector<AutofillProfile*>& profiles) { |
61 std::string result; | 61 std::string result; |
62 for (size_t i = 0; i < profiles.size(); ++i) { | 62 for (size_t i = 0; i < profiles.size(); ++i) { |
63 result += kProfileSeparator; | 63 result += kProfileSeparator; |
64 result += "\n"; | 64 result += "\n"; |
65 for (size_t j = 0; j < arraysize(kProfileFieldTypes); ++j) { | 65 for (size_t j = 0; j < arraysize(kProfileFieldTypes); ++j) { |
66 ServerFieldType type = kProfileFieldTypes[j]; | 66 ServerFieldType type = kProfileFieldTypes[j]; |
67 std::vector<base::string16> values; | 67 std::vector<base::string16> values; |
68 profiles[i]->GetRawMultiInfo(type, &values); | 68 profiles[i]->GetRawMultiInfo(type, &values); |
69 for (size_t k = 0; k < values.size(); ++k) { | 69 for (size_t k = 0; k < values.size(); ++k) { |
70 result += AutofillType::FieldTypeToString(type); | 70 result += AutofillType(type).ToString(); |
71 result += kFieldSeparator; | 71 result += kFieldSeparator; |
72 result += UTF16ToUTF8(values[k]); | 72 result += UTF16ToUTF8(values[k]); |
73 result += "\n"; | 73 result += "\n"; |
74 } | 74 } |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 return result; | 78 return result; |
79 } | 79 } |
80 | 80 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 *merged_profiles = SerializeProfiles(personal_data_.web_profiles()); | 227 *merged_profiles = SerializeProfiles(personal_data_.web_profiles()); |
228 } | 228 } |
229 | 229 |
230 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { | 230 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { |
231 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), | 231 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), |
232 kFileNamePattern); | 232 kFileNamePattern); |
233 } | 233 } |
234 | 234 |
235 } // namespace autofill | 235 } // namespace autofill |
OLD | NEW |