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 using base::ASCIIToUTF16; | 14 using base::ASCIIToUTF16; |
15 | 15 |
16 namespace autofill { | 16 namespace autofill { |
17 | 17 |
18 class CreditCardFieldTest : public testing::Test { | 18 class CreditCardFieldTest : public testing::Test { |
19 public: | 19 public: |
20 CreditCardFieldTest() {} | 20 CreditCardFieldTest() {} |
21 virtual ~CreditCardFieldTest() {} | 21 ~CreditCardFieldTest() override {} |
22 | 22 |
23 protected: | 23 protected: |
24 ScopedVector<AutofillField> list_; | 24 ScopedVector<AutofillField> list_; |
25 scoped_ptr<const CreditCardField> field_; | 25 scoped_ptr<const CreditCardField> field_; |
26 ServerFieldTypeMap field_type_map_; | 26 ServerFieldTypeMap field_type_map_; |
27 | 27 |
28 // Parses the contents of |list_| as a form, and stores the result into | 28 // Parses the contents of |list_| as a form, and stores the result into |
29 // |field_|. | 29 // |field_|. |
30 void Parse() { | 30 void Parse() { |
31 AutofillScanner scanner(list_.get()); | 31 AutofillScanner scanner(list_.get()); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 ASSERT_TRUE(field_type_map_.find(ASCIIToUTF16("month4")) != | 488 ASSERT_TRUE(field_type_map_.find(ASCIIToUTF16("month4")) != |
489 field_type_map_.end()); | 489 field_type_map_.end()); |
490 EXPECT_EQ(CREDIT_CARD_EXP_MONTH, field_type_map_[ASCIIToUTF16("month4")]); | 490 EXPECT_EQ(CREDIT_CARD_EXP_MONTH, field_type_map_[ASCIIToUTF16("month4")]); |
491 ASSERT_TRUE(field_type_map_.find(ASCIIToUTF16("year5")) != | 491 ASSERT_TRUE(field_type_map_.find(ASCIIToUTF16("year5")) != |
492 field_type_map_.end()); | 492 field_type_map_.end()); |
493 EXPECT_EQ(CREDIT_CARD_EXP_4_DIGIT_YEAR, | 493 EXPECT_EQ(CREDIT_CARD_EXP_4_DIGIT_YEAR, |
494 field_type_map_[ASCIIToUTF16("year5")]); | 494 field_type_map_[ASCIIToUTF16("year5")]); |
495 } | 495 } |
496 | 496 |
497 } // namespace autofill | 497 } // namespace autofill |
OLD | NEW |