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_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.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 "chrome/browser/autofill/autofill_field.h" |
9 #include "chrome/browser/autofill/autofill_scanner.h" | 9 #include "chrome/browser/autofill/autofill_scanner.h" |
10 #include "chrome/browser/autofill/name_field.h" | 10 #include "chrome/browser/autofill/name_field.h" |
11 #include "chrome/common/form_field_data.h" | 11 #include "chrome/common/form_field_data.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 class NameFieldTest : public testing::Test { | 14 class NameFieldTest : public testing::Test { |
15 public: | 15 public: |
16 NameFieldTest() {} | 16 NameFieldTest() {} |
17 | 17 |
18 protected: | 18 protected: |
19 ScopedVector<const AutofillField> list_; | 19 ScopedVector<const AutofillField> list_; |
20 scoped_ptr<NameField> field_; | 20 scoped_ptr<NameField> field_; |
21 FieldTypeMap field_type_map_; | 21 FieldTypeMap field_type_map_; |
22 | 22 |
23 // Downcast for tests. | 23 // Downcast for tests. |
24 static NameField* Parse(AutofillScanner* scanner) { | 24 static NameField* Parse(AutofillScanner* scanner) { |
25 return static_cast<NameField*>(NameField::Parse(scanner, false)); | 25 return static_cast<NameField*>(NameField::Parse(scanner)); |
26 } | 26 } |
27 | 27 |
28 private: | 28 private: |
29 DISALLOW_COPY_AND_ASSIGN(NameFieldTest); | 29 DISALLOW_COPY_AND_ASSIGN(NameFieldTest); |
30 }; | 30 }; |
31 | 31 |
32 TEST_F(NameFieldTest, FirstMiddleLast) { | 32 TEST_F(NameFieldTest, FirstMiddleLast) { |
33 FormFieldData field; | 33 FormFieldData field; |
34 field.form_control_type = "text"; | 34 field.form_control_type = "text"; |
35 | 35 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 ASSERT_TRUE( | 298 ASSERT_TRUE( |
299 field_type_map_.find(ASCIIToUTF16("name1")) != field_type_map_.end()); | 299 field_type_map_.find(ASCIIToUTF16("name1")) != field_type_map_.end()); |
300 EXPECT_EQ(NAME_FIRST, field_type_map_[ASCIIToUTF16("name1")]); | 300 EXPECT_EQ(NAME_FIRST, field_type_map_[ASCIIToUTF16("name1")]); |
301 ASSERT_TRUE( | 301 ASSERT_TRUE( |
302 field_type_map_.find(ASCIIToUTF16("name2")) != field_type_map_.end()); | 302 field_type_map_.find(ASCIIToUTF16("name2")) != field_type_map_.end()); |
303 EXPECT_EQ(NAME_MIDDLE_INITIAL, field_type_map_[ASCIIToUTF16("name2")]); | 303 EXPECT_EQ(NAME_MIDDLE_INITIAL, field_type_map_[ASCIIToUTF16("name2")]); |
304 ASSERT_TRUE( | 304 ASSERT_TRUE( |
305 field_type_map_.find(ASCIIToUTF16("name3")) != field_type_map_.end()); | 305 field_type_map_.find(ASCIIToUTF16("name3")) != field_type_map_.end()); |
306 EXPECT_EQ(NAME_LAST, field_type_map_[ASCIIToUTF16("name3")]); | 306 EXPECT_EQ(NAME_LAST, field_type_map_[ASCIIToUTF16("name3")]); |
307 } | 307 } |
OLD | NEW |