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 "base/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
6 #include "base/strings/string16.h" | 6 #include "base/strings/string16.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "components/autofill/core/browser/autofill_field.h" | 8 #include "components/autofill/core/browser/autofill_field.h" |
9 #include "components/autofill/core/browser/form_field.h" | 9 #include "components/autofill/core/browser/form_field.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 field_data.is_checkable = true; | 132 field_data.is_checkable = true; |
133 field_data.label = ASCIIToUTF16("Is PO Box"); | 133 field_data.label = ASCIIToUTF16("Is PO Box"); |
134 fields.push_back(new AutofillField(field_data, field_data.label)); | 134 fields.push_back(new AutofillField(field_data, field_data.label)); |
135 | 135 |
136 // reset is_checkable to false. | 136 // reset is_checkable to false. |
137 field_data.is_checkable = false; | 137 field_data.is_checkable = false; |
138 field_data.label = ASCIIToUTF16("Address line2"); | 138 field_data.label = ASCIIToUTF16("Address line2"); |
139 fields.push_back(new AutofillField(field_data, field_data.label)); | 139 fields.push_back(new AutofillField(field_data, field_data.label)); |
140 | 140 |
141 FieldTypeMap field_type_map; | 141 ServerFieldTypeMap field_type_map; |
142 FormField::ParseFormFields(fields.get(), &field_type_map); | 142 FormField::ParseFormFields(fields.get(), &field_type_map); |
143 // Checkable element shouldn't interfere with inference of Address line2. | 143 // Checkable element shouldn't interfere with inference of Address line2. |
144 EXPECT_EQ(2U, field_type_map.size()); | 144 EXPECT_EQ(2U, field_type_map.size()); |
145 | 145 |
146 EXPECT_EQ(ADDRESS_HOME_LINE1, | 146 EXPECT_EQ(ADDRESS_HOME_LINE1, |
147 field_type_map.find(ASCIIToUTF16("Address line1"))->second); | 147 field_type_map.find(ASCIIToUTF16("Address line1"))->second); |
148 EXPECT_EQ(ADDRESS_HOME_LINE2, | 148 EXPECT_EQ(ADDRESS_HOME_LINE2, |
149 field_type_map.find(ASCIIToUTF16("Address line2"))->second); | 149 field_type_map.find(ASCIIToUTF16("Address line2"))->second); |
150 } | 150 } |
151 | 151 |
152 } // namespace autofill | 152 } // namespace autofill |
OLD | NEW |