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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "components/autofill/core/browser/autofill_test_utils.h" | 16 #include "components/autofill/core/browser/autofill_test_utils.h" |
17 #include "components/autofill/core/browser/autofill_type.h" | 17 #include "components/autofill/core/browser/autofill_type.h" |
| 18 #include "components/autofill/core/browser/country_names.h" |
18 #include "components/autofill/core/browser/data_driven_test.h" | 19 #include "components/autofill/core/browser/data_driven_test.h" |
19 #include "components/autofill/core/browser/form_structure.h" | 20 #include "components/autofill/core/browser/form_structure.h" |
20 #include "components/autofill/core/browser/personal_data_manager.h" | 21 #include "components/autofill/core/browser/personal_data_manager.h" |
21 #include "components/autofill/core/common/form_data.h" | 22 #include "components/autofill/core/common/form_data.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
24 | 25 |
25 namespace autofill { | 26 namespace autofill { |
26 | 27 |
27 namespace { | 28 namespace { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 151 |
151 PersonalDataManagerMock personal_data_; | 152 PersonalDataManagerMock personal_data_; |
152 | 153 |
153 private: | 154 private: |
154 std::map<std::string, ServerFieldType> string_to_field_type_map_; | 155 std::map<std::string, ServerFieldType> string_to_field_type_map_; |
155 | 156 |
156 DISALLOW_COPY_AND_ASSIGN(AutofillMergeTest); | 157 DISALLOW_COPY_AND_ASSIGN(AutofillMergeTest); |
157 }; | 158 }; |
158 | 159 |
159 AutofillMergeTest::AutofillMergeTest() : DataDrivenTest(GetTestDataDir()) { | 160 AutofillMergeTest::AutofillMergeTest() : DataDrivenTest(GetTestDataDir()) { |
| 161 CountryNames::SetLocaleString("en-US"); |
160 for (size_t i = NO_SERVER_DATA; i < MAX_VALID_FIELD_TYPE; ++i) { | 162 for (size_t i = NO_SERVER_DATA; i < MAX_VALID_FIELD_TYPE; ++i) { |
161 ServerFieldType field_type = static_cast<ServerFieldType>(i); | 163 ServerFieldType field_type = static_cast<ServerFieldType>(i); |
162 string_to_field_type_map_[AutofillType(field_type).ToString()] = field_type; | 164 string_to_field_type_map_[AutofillType(field_type).ToString()] = field_type; |
163 } | 165 } |
164 } | 166 } |
165 | 167 |
166 AutofillMergeTest::~AutofillMergeTest() { | 168 AutofillMergeTest::~AutofillMergeTest() { |
167 } | 169 } |
168 | 170 |
169 void AutofillMergeTest::SetUp() { | 171 void AutofillMergeTest::SetUp() { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 ServerFieldType AutofillMergeTest::StringToFieldType(const std::string& str) { | 243 ServerFieldType AutofillMergeTest::StringToFieldType(const std::string& str) { |
242 return string_to_field_type_map_[str]; | 244 return string_to_field_type_map_[str]; |
243 } | 245 } |
244 | 246 |
245 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { | 247 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { |
246 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), | 248 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), |
247 kFileNamePattern); | 249 kFileNamePattern); |
248 } | 250 } |
249 | 251 |
250 } // namespace autofill | 252 } // namespace autofill |
OLD | NEW |