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/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/autofill/core/browser/address_field.h" | 9 #include "components/autofill/core/browser/address_field.h" |
10 #include "components/autofill/core/browser/autofill_field.h" | 10 #include "components/autofill/core/browser/autofill_field.h" |
11 #include "components/autofill/core/browser/autofill_scanner.h" | 11 #include "components/autofill/core/browser/autofill_scanner.h" |
12 #include "components/autofill/core/common/form_field_data.h" | 12 #include "components/autofill/core/common/form_field_data.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 using base::ASCIIToUTF16; | 15 using base::ASCIIToUTF16; |
16 | 16 |
17 namespace autofill { | 17 namespace autofill { |
18 | 18 |
19 class AddressFieldTest : public testing::Test { | 19 class AddressFieldTest : public testing::Test { |
20 public: | 20 public: |
21 AddressFieldTest() {} | 21 AddressFieldTest() {} |
22 | 22 |
23 protected: | 23 protected: |
24 ScopedVector<const AutofillField> list_; | 24 ScopedVector<AutofillField> list_; |
25 scoped_ptr<AddressField> field_; | 25 scoped_ptr<AddressField> field_; |
26 ServerFieldTypeMap field_type_map_; | 26 ServerFieldTypeMap field_type_map_; |
27 | 27 |
28 // Downcast for tests. | 28 // Downcast for tests. |
29 static AddressField* Parse(AutofillScanner* scanner) { | 29 static AddressField* Parse(AutofillScanner* scanner) { |
30 return static_cast<AddressField*>(AddressField::Parse(scanner)); | 30 return static_cast<AddressField*>(AddressField::Parse(scanner)); |
31 } | 31 } |
32 | 32 |
33 private: | 33 private: |
34 DISALLOW_COPY_AND_ASSIGN(AddressFieldTest); | 34 DISALLOW_COPY_AND_ASSIGN(AddressFieldTest); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 AutofillScanner scanner(list_.get()); | 262 AutofillScanner scanner(list_.get()); |
263 field_.reset(Parse(&scanner)); | 263 field_.reset(Parse(&scanner)); |
264 ASSERT_NE(static_cast<AddressField*>(NULL), field_.get()); | 264 ASSERT_NE(static_cast<AddressField*>(NULL), field_.get()); |
265 ASSERT_TRUE(field_->ClassifyField(&field_type_map_)); | 265 ASSERT_TRUE(field_->ClassifyField(&field_type_map_)); |
266 ASSERT_TRUE( | 266 ASSERT_TRUE( |
267 field_type_map_.find(ASCIIToUTF16("company1")) != field_type_map_.end()); | 267 field_type_map_.find(ASCIIToUTF16("company1")) != field_type_map_.end()); |
268 EXPECT_EQ(COMPANY_NAME, field_type_map_[ASCIIToUTF16("company1")]); | 268 EXPECT_EQ(COMPANY_NAME, field_type_map_[ASCIIToUTF16("company1")]); |
269 } | 269 } |
270 | 270 |
271 } // namespace autofill | 271 } // namespace autofill |
OLD | NEW |