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 "base/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
6 #include "base/string16.h" | 6 #include "base/string16.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/autofill/autofill_field.h" | 8 #include "components/autofill/browser/autofill_field.h" |
9 #include "chrome/browser/autofill/form_field.h" | 9 #include "components/autofill/browser/form_field.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 TEST(FormFieldTest, Match) { | 12 TEST(FormFieldTest, Match) { |
13 AutofillField field; | 13 AutofillField field; |
14 | 14 |
15 // Empty strings match. | 15 // Empty strings match. |
16 EXPECT_TRUE(FormField::Match(&field, string16(), FormField::MATCH_LABEL)); | 16 EXPECT_TRUE(FormField::Match(&field, string16(), FormField::MATCH_LABEL)); |
17 | 17 |
18 // Empty pattern matches non-empty string. | 18 // Empty pattern matches non-empty string. |
19 field.label = ASCIIToUTF16("a"); | 19 field.label = ASCIIToUTF16("a"); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 FieldTypeMap field_type_map; | 137 FieldTypeMap field_type_map; |
138 FormField::ParseFormFields(fields.get(), &field_type_map); | 138 FormField::ParseFormFields(fields.get(), &field_type_map); |
139 // Checkable element shouldn't interfere with inference of Address line2. | 139 // Checkable element shouldn't interfere with inference of Address line2. |
140 EXPECT_EQ(2U, field_type_map.size()); | 140 EXPECT_EQ(2U, field_type_map.size()); |
141 | 141 |
142 EXPECT_EQ(ADDRESS_HOME_LINE1, | 142 EXPECT_EQ(ADDRESS_HOME_LINE1, |
143 field_type_map.find(ASCIIToUTF16("Address line1"))->second); | 143 field_type_map.find(ASCIIToUTF16("Address line1"))->second); |
144 EXPECT_EQ(ADDRESS_HOME_LINE2, | 144 EXPECT_EQ(ADDRESS_HOME_LINE2, |
145 field_type_map.find(ASCIIToUTF16("Address line2"))->second); | 145 field_type_map.find(ASCIIToUTF16("Address line2"))->second); |
146 } | 146 } |
OLD | NEW |