| 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/credit_card_field.h" | 10 #include "components/autofill/core/browser/credit_card_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 namespace autofill { | 14 namespace autofill { |
| 15 | 15 |
| 16 class CreditCardFieldTest : public testing::Test { | 16 class CreditCardFieldTest : public testing::Test { |
| 17 public: | 17 public: |
| 18 CreditCardFieldTest() {} | 18 CreditCardFieldTest() {} |
| 19 | 19 |
| 20 protected: | 20 protected: |
| 21 ScopedVector<const AutofillField> list_; | 21 ScopedVector<const AutofillField> list_; |
| 22 scoped_ptr<CreditCardField> field_; | 22 scoped_ptr<CreditCardField> field_; |
| 23 FieldTypeMap field_type_map_; | 23 ServerFieldTypeMap field_type_map_; |
| 24 | 24 |
| 25 // Downcast for tests. | 25 // Downcast for tests. |
| 26 static CreditCardField* Parse(AutofillScanner* scanner) { | 26 static CreditCardField* Parse(AutofillScanner* scanner) { |
| 27 return static_cast<CreditCardField*>(CreditCardField::Parse(scanner)); | 27 return static_cast<CreditCardField*>(CreditCardField::Parse(scanner)); |
| 28 } | 28 } |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 DISALLOW_COPY_AND_ASSIGN(CreditCardFieldTest); | 31 DISALLOW_COPY_AND_ASSIGN(CreditCardFieldTest); |
| 32 }; | 32 }; |
| 33 | 33 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 AutofillScanner scanner(list_.get()); | 313 AutofillScanner scanner(list_.get()); |
| 314 field_.reset(Parse(&scanner)); | 314 field_.reset(Parse(&scanner)); |
| 315 ASSERT_NE(static_cast<CreditCardField*>(NULL), field_.get()); | 315 ASSERT_NE(static_cast<CreditCardField*>(NULL), field_.get()); |
| 316 ASSERT_TRUE(field_->ClassifyField(&field_type_map_)); | 316 ASSERT_TRUE(field_->ClassifyField(&field_type_map_)); |
| 317 ASSERT_TRUE( | 317 ASSERT_TRUE( |
| 318 field_type_map_.find(ASCIIToUTF16("name1")) != field_type_map_.end()); | 318 field_type_map_.find(ASCIIToUTF16("name1")) != field_type_map_.end()); |
| 319 EXPECT_EQ(CREDIT_CARD_NAME, field_type_map_[ASCIIToUTF16("name1")]); | 319 EXPECT_EQ(CREDIT_CARD_NAME, field_type_map_[ASCIIToUTF16("name1")]); |
| 320 } | 320 } |
| 321 | 321 |
| 322 } // namespace autofill | 322 } // namespace autofill |
| OLD | NEW |