| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } else { | 559 } else { |
| 560 EXPECT_EQ(wrapper1.GetInfo(AutofillType(input.type)), | 560 EXPECT_EQ(wrapper1.GetInfo(AutofillType(input.type)), |
| 561 view->GetTextContentsOfInput(input)); | 561 view->GetTextContentsOfInput(input)); |
| 562 } | 562 } |
| 563 } | 563 } |
| 564 } | 564 } |
| 565 | 565 |
| 566 // Tests that credit card number is disabled while editing a Wallet instrument. | 566 // Tests that credit card number is disabled while editing a Wallet instrument. |
| 567 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, WalletCreditCardDisabled) { | 567 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, WalletCreditCardDisabled) { |
| 568 controller()->OnUserNameFetchSuccess("user@example.com"); | 568 controller()->OnUserNameFetchSuccess("user@example.com"); |
| 569 controller()->OnDidFetchWalletCookieValue(std::string()); |
| 569 | 570 |
| 570 scoped_ptr<wallet::WalletItems> wallet_items = | 571 scoped_ptr<wallet::WalletItems> wallet_items = |
| 571 wallet::GetTestWalletItems(wallet::AMEX_DISALLOWED); | 572 wallet::GetTestWalletItems(wallet::AMEX_DISALLOWED); |
| 572 // An expired card will be forced into edit mode. | 573 // An expired card will be forced into edit mode. |
| 573 wallet_items->AddInstrument(wallet::GetTestMaskedInstrumentWithDetails( | 574 wallet_items->AddInstrument(wallet::GetTestMaskedInstrumentWithDetails( |
| 574 "instrument_id", | 575 "instrument_id", |
| 575 wallet::GetTestAddress(), | 576 wallet::GetTestAddress(), |
| 576 wallet::WalletItems::MaskedInstrument::VISA, | 577 wallet::WalletItems::MaskedInstrument::VISA, |
| 577 wallet::WalletItems::MaskedInstrument::EXPIRED)); | 578 wallet::WalletItems::MaskedInstrument::EXPIRED)); |
| 578 controller()->OnDidGetWalletItems(wallet_items.Pass()); | 579 controller()->OnDidGetWalletItems(wallet_items.Pass()); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 EXPECT_TRUE(controller()->SectionIsActive(SECTION_BILLING)); | 727 EXPECT_TRUE(controller()->SectionIsActive(SECTION_BILLING)); |
| 727 EXPECT_FALSE(controller()->SectionIsActive(SECTION_CC_BILLING)); | 728 EXPECT_FALSE(controller()->SectionIsActive(SECTION_CC_BILLING)); |
| 728 EXPECT_TRUE(controller()->SectionIsActive(SECTION_SHIPPING)); | 729 EXPECT_TRUE(controller()->SectionIsActive(SECTION_SHIPPING)); |
| 729 | 730 |
| 730 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_CC)); | 731 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_CC)); |
| 731 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_BILLING)); | 732 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_BILLING)); |
| 732 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); | 733 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); |
| 733 | 734 |
| 734 // Set up some Wallet state. | 735 // Set up some Wallet state. |
| 735 controller()->OnUserNameFetchSuccess("user@example.com"); | 736 controller()->OnUserNameFetchSuccess("user@example.com"); |
| 737 controller()->OnDidFetchWalletCookieValue(std::string()); |
| 736 controller()->OnDidGetWalletItems( | 738 controller()->OnDidGetWalletItems( |
| 737 wallet::GetTestWalletItems(wallet::AMEX_DISALLOWED)); | 739 wallet::GetTestWalletItems(wallet::AMEX_DISALLOWED)); |
| 738 | 740 |
| 739 ui::MenuModel* account_chooser = controller()->MenuModelForAccountChooser(); | 741 ui::MenuModel* account_chooser = controller()->MenuModelForAccountChooser(); |
| 740 ASSERT_TRUE(account_chooser->IsItemCheckedAt(0)); | 742 ASSERT_TRUE(account_chooser->IsItemCheckedAt(0)); |
| 741 | 743 |
| 742 // Check that the view's in the state we expect before starting to simulate | 744 // Check that the view's in the state we expect before starting to simulate |
| 743 // user input. | 745 // user input. |
| 744 EXPECT_FALSE(controller()->SectionIsActive(SECTION_CC)); | 746 EXPECT_FALSE(controller()->SectionIsActive(SECTION_CC)); |
| 745 EXPECT_FALSE(controller()->SectionIsActive(SECTION_BILLING)); | 747 EXPECT_FALSE(controller()->SectionIsActive(SECTION_BILLING)); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 EXPECT_EQ(cc_number.type, new_cc_number.type); | 789 EXPECT_EQ(cc_number.type, new_cc_number.type); |
| 788 EXPECT_EQ(ASCIIToUTF16("4111111111111111"), | 790 EXPECT_EQ(ASCIIToUTF16("4111111111111111"), |
| 789 view->GetTextContentsOfInput(new_cc_number)); | 791 view->GetTextContentsOfInput(new_cc_number)); |
| 790 | 792 |
| 791 EXPECT_NE(ASCIIToUTF16("shipping name"), | 793 EXPECT_NE(ASCIIToUTF16("shipping name"), |
| 792 view->GetTextContentsOfInput(shipping_zip)); | 794 view->GetTextContentsOfInput(shipping_zip)); |
| 793 } | 795 } |
| 794 #endif // defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) | 796 #endif // defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) |
| 795 | 797 |
| 796 } // namespace autofill | 798 } // namespace autofill |
| OLD | NEW |