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_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/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/autofill_scanner.h" | 9 #include "components/autofill/core/browser/autofill_scanner.h" |
10 #include "components/autofill/core/browser/phone_field.h" | 10 #include "components/autofill/core/browser/phone_field.h" |
11 #include "components/autofill/core/common/form_field_data.h" | 11 #include "components/autofill/core/common/form_field_data.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 using base::ASCIIToUTF16; | 14 using base::ASCIIToUTF16; |
15 | 15 |
16 namespace autofill { | 16 namespace autofill { |
17 | 17 |
18 class PhoneFieldTest : public testing::Test { | 18 class PhoneFieldTest : public testing::Test { |
19 public: | 19 public: |
20 PhoneFieldTest() {} | 20 PhoneFieldTest() {} |
21 | 21 |
22 protected: | 22 protected: |
23 ScopedVector<const AutofillField> list_; | 23 ScopedVector<AutofillField> list_; |
24 scoped_ptr<PhoneField> field_; | 24 scoped_ptr<PhoneField> field_; |
25 ServerFieldTypeMap field_type_map_; | 25 ServerFieldTypeMap field_type_map_; |
26 | 26 |
27 // Downcast for tests. | 27 // Downcast for tests. |
28 static PhoneField* Parse(AutofillScanner* scanner) { | 28 static PhoneField* Parse(AutofillScanner* scanner) { |
29 return static_cast<PhoneField*>(PhoneField::Parse(scanner)); | 29 return static_cast<PhoneField*>(PhoneField::Parse(scanner)); |
30 } | 30 } |
31 | 31 |
32 private: | 32 private: |
33 DISALLOW_COPY_AND_ASSIGN(PhoneFieldTest); | 33 DISALLOW_COPY_AND_ASSIGN(PhoneFieldTest); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 ASSERT_TRUE(field_->ClassifyField(&field_type_map_)); | 223 ASSERT_TRUE(field_->ClassifyField(&field_type_map_)); |
224 ASSERT_TRUE( | 224 ASSERT_TRUE( |
225 field_type_map_.find(ASCIIToUTF16("country")) != field_type_map_.end()); | 225 field_type_map_.find(ASCIIToUTF16("country")) != field_type_map_.end()); |
226 EXPECT_EQ(PHONE_HOME_COUNTRY_CODE, field_type_map_[ASCIIToUTF16("country")]); | 226 EXPECT_EQ(PHONE_HOME_COUNTRY_CODE, field_type_map_[ASCIIToUTF16("country")]); |
227 ASSERT_TRUE( | 227 ASSERT_TRUE( |
228 field_type_map_.find(ASCIIToUTF16("phone")) != field_type_map_.end()); | 228 field_type_map_.find(ASCIIToUTF16("phone")) != field_type_map_.end()); |
229 EXPECT_EQ(PHONE_HOME_CITY_AND_NUMBER, field_type_map_[ASCIIToUTF16("phone")]); | 229 EXPECT_EQ(PHONE_HOME_CITY_AND_NUMBER, field_type_map_[ASCIIToUTF16("phone")]); |
230 } | 230 } |
231 | 231 |
232 } // namespace autofill | 232 } // namespace autofill |
OLD | NEW |