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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 | 1618 |
1619 std::vector<FormData> forms(1, form); | 1619 std::vector<FormData> forms(1, form); |
1620 FormsSeen(forms); | 1620 FormsSeen(forms); |
1621 | 1621 |
1622 AutofillProfile* profile = new AutofillProfile; | 1622 AutofillProfile* profile = new AutofillProfile; |
1623 profile->set_guid("00000000-0000-0000-0000-000000000104"); | 1623 profile->set_guid("00000000-0000-0000-0000-000000000104"); |
1624 profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("1800FLOWERS")); | 1624 profile->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16("1800FLOWERS")); |
1625 personal_data_.ClearAutofillProfiles(); | 1625 personal_data_.ClearAutofillProfiles(); |
1626 autofill_manager_->AddProfile(profile); | 1626 autofill_manager_->AddProfile(profile); |
1627 | 1627 |
1628 // The sublabels here are somewhat braindead until crbug.com/493247 is fixed. | |
1629 // TODO(estade): fix the bug and fix this test. | |
1630 const FormFieldData& phone_prefix = form.fields[2]; | 1628 const FormFieldData& phone_prefix = form.fields[2]; |
1631 GetAutofillSuggestions(form, phone_prefix); | 1629 GetAutofillSuggestions(form, phone_prefix); |
1632 | 1630 |
1633 // Test that we sent the right prefix values to the external delegate. | 1631 // Test that we sent the right prefix values to the external delegate. |
1634 external_delegate_->CheckSuggestions(kDefaultPageID, | 1632 external_delegate_->CheckSuggestions(kDefaultPageID, |
1635 Suggestion("356", "18003569377", "", 1)); | 1633 Suggestion("356", "1800FLOWERS", "", 1)); |
1636 | 1634 |
1637 const FormFieldData& phone_suffix = form.fields[3]; | 1635 const FormFieldData& phone_suffix = form.fields[3]; |
1638 GetAutofillSuggestions(form, phone_suffix); | 1636 GetAutofillSuggestions(form, phone_suffix); |
1639 | 1637 |
1640 // Test that we sent the right suffix values to the external delegate. | 1638 // Test that we sent the right suffix values to the external delegate. |
1641 external_delegate_->CheckSuggestions( | 1639 external_delegate_->CheckSuggestions( |
1642 kDefaultPageID, Suggestion("9377", "18003569377", "", 1)); | 1640 kDefaultPageID, Suggestion("9377", "1800FLOWERS", "", 1)); |
1643 } | 1641 } |
1644 | 1642 |
1645 // Test that we correctly fill an address form. | 1643 // Test that we correctly fill an address form. |
1646 TEST_F(AutofillManagerTest, FillAddressForm) { | 1644 TEST_F(AutofillManagerTest, FillAddressForm) { |
1647 // Set up our form data. | 1645 // Set up our form data. |
1648 FormData form; | 1646 FormData form; |
1649 test::CreateTestAddressFormData(&form); | 1647 test::CreateTestAddressFormData(&form); |
1650 std::vector<FormData> forms(1, form); | 1648 std::vector<FormData> forms(1, form); |
1651 FormsSeen(forms); | 1649 FormsSeen(forms); |
1652 | 1650 |
(...skipping 2405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4058 FormsSeen(mixed_forms); | 4056 FormsSeen(mixed_forms); |
4059 | 4057 |
4060 // Suggestions should always be displayed. | 4058 // Suggestions should always be displayed. |
4061 for (const FormFieldData& field : mixed_form.fields) { | 4059 for (const FormFieldData& field : mixed_form.fields) { |
4062 GetAutofillSuggestions(mixed_form, field); | 4060 GetAutofillSuggestions(mixed_form, field); |
4063 EXPECT_TRUE(external_delegate_->on_suggestions_returned_seen()); | 4061 EXPECT_TRUE(external_delegate_->on_suggestions_returned_seen()); |
4064 } | 4062 } |
4065 } | 4063 } |
4066 | 4064 |
4067 } // namespace autofill | 4065 } // namespace autofill |
OLD | NEW |