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/stringprintf.h" | 5 #include "base/stringprintf.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/autofill/autofill_profile.h" | 7 #include "chrome/browser/autofill/autofill_profile.h" |
8 #include "chrome/browser/autofill/autofill_type.h" | 8 #include "chrome/browser/autofill/autofill_type.h" |
9 #include "chrome/browser/autofill/credit_card.h" | 9 #include "chrome/browser/autofill/credit_card.h" |
10 #include "chrome/browser/autofill/select_control_handler.h" | 10 #include "chrome/browser/autofill/select_control_handler.h" |
11 #include "chrome/test/base/testing_browser_process_test.h" | |
12 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "webkit/glue/form_field.h" | 12 #include "webkit/glue/form_field.h" |
14 | 13 |
15 typedef TestingBrowserProcessTest SelectControlHandlerTest; | 14 typedef testing::Test SelectControlHandlerTest; |
16 | 15 |
17 TEST_F(SelectControlHandlerTest, CreditCardMonthExact) { | 16 TEST_F(SelectControlHandlerTest, CreditCardMonthExact) { |
18 const char* const kMonthsNumeric[] = { | 17 const char* const kMonthsNumeric[] = { |
19 "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", | 18 "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", |
20 }; | 19 }; |
21 std::vector<string16> options(arraysize(kMonthsNumeric)); | 20 std::vector<string16> options(arraysize(kMonthsNumeric)); |
22 for (size_t i = 0; i < arraysize(kMonthsNumeric); ++i) | 21 for (size_t i = 0; i < arraysize(kMonthsNumeric); ++i) |
23 options[i] = ASCIIToUTF16(kMonthsNumeric[i]); | 22 options[i] = ASCIIToUTF16(kMonthsNumeric[i]); |
24 | 23 |
25 webkit_glue::FormField field; | 24 webkit_glue::FormField field; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 webkit_glue::FormField field; | 203 webkit_glue::FormField field; |
205 field.form_control_type = ASCIIToUTF16("select-one"); | 204 field.form_control_type = ASCIIToUTF16("select-one"); |
206 field.option_values = values; | 205 field.option_values = values; |
207 field.option_contents = contents; | 206 field.option_contents = contents; |
208 | 207 |
209 AutofillProfile profile; | 208 AutofillProfile profile; |
210 profile.SetInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("California")); | 209 profile.SetInfo(ADDRESS_HOME_STATE, ASCIIToUTF16("California")); |
211 autofill::FillSelectControl(profile, ADDRESS_HOME_STATE, &field); | 210 autofill::FillSelectControl(profile, ADDRESS_HOME_STATE, &field); |
212 EXPECT_EQ(ASCIIToUTF16("2"), field.value); | 211 EXPECT_EQ(ASCIIToUTF16("2"), field.value); |
213 } | 212 } |
OLD | NEW |