| 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 = wallet::GetTestWalletItems(); | 571 scoped_ptr<wallet::WalletItems> wallet_items = wallet::GetTestWalletItems(); |
| 571 // An expired card will be forced into edit mode. | 572 // An expired card will be forced into edit mode. |
| 572 wallet_items->AddInstrument(wallet::GetTestMaskedInstrumentWithDetails( | 573 wallet_items->AddInstrument(wallet::GetTestMaskedInstrumentWithDetails( |
| 573 "instrument_id", | 574 "instrument_id", |
| 574 wallet::GetTestAddress(), | 575 wallet::GetTestAddress(), |
| 575 wallet::WalletItems::MaskedInstrument::VISA, | 576 wallet::WalletItems::MaskedInstrument::VISA, |
| 576 wallet::WalletItems::MaskedInstrument::EXPIRED)); | 577 wallet::WalletItems::MaskedInstrument::EXPIRED)); |
| 577 controller()->OnDidGetWalletItems(wallet_items.Pass()); | 578 controller()->OnDidGetWalletItems(wallet_items.Pass()); |
| 578 | 579 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 EXPECT_TRUE(controller()->SectionIsActive(SECTION_BILLING)); | 726 EXPECT_TRUE(controller()->SectionIsActive(SECTION_BILLING)); |
| 726 EXPECT_FALSE(controller()->SectionIsActive(SECTION_CC_BILLING)); | 727 EXPECT_FALSE(controller()->SectionIsActive(SECTION_CC_BILLING)); |
| 727 EXPECT_TRUE(controller()->SectionIsActive(SECTION_SHIPPING)); | 728 EXPECT_TRUE(controller()->SectionIsActive(SECTION_SHIPPING)); |
| 728 | 729 |
| 729 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_CC)); | 730 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_CC)); |
| 730 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_BILLING)); | 731 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_BILLING)); |
| 731 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); | 732 EXPECT_FALSE(controller()->IsManuallyEditingSection(SECTION_SHIPPING)); |
| 732 | 733 |
| 733 // Set up some Wallet state. | 734 // Set up some Wallet state. |
| 734 controller()->OnUserNameFetchSuccess("user@example.com"); | 735 controller()->OnUserNameFetchSuccess("user@example.com"); |
| 736 controller()->OnDidFetchWalletCookieValue(std::string()); |
| 735 controller()->OnDidGetWalletItems(wallet::GetTestWalletItems()); | 737 controller()->OnDidGetWalletItems(wallet::GetTestWalletItems()); |
| 736 | 738 |
| 737 ui::MenuModel* account_chooser = controller()->MenuModelForAccountChooser(); | 739 ui::MenuModel* account_chooser = controller()->MenuModelForAccountChooser(); |
| 738 ASSERT_TRUE(account_chooser->IsItemCheckedAt(0)); | 740 ASSERT_TRUE(account_chooser->IsItemCheckedAt(0)); |
| 739 | 741 |
| 740 // Check that the view's in the state we expect before starting to simulate | 742 // Check that the view's in the state we expect before starting to simulate |
| 741 // user input. | 743 // user input. |
| 742 EXPECT_FALSE(controller()->SectionIsActive(SECTION_CC)); | 744 EXPECT_FALSE(controller()->SectionIsActive(SECTION_CC)); |
| 743 EXPECT_FALSE(controller()->SectionIsActive(SECTION_BILLING)); | 745 EXPECT_FALSE(controller()->SectionIsActive(SECTION_BILLING)); |
| 744 EXPECT_TRUE(controller()->SectionIsActive(SECTION_CC_BILLING)); | 746 EXPECT_TRUE(controller()->SectionIsActive(SECTION_CC_BILLING)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 EXPECT_EQ(cc_number.type, new_cc_number.type); | 787 EXPECT_EQ(cc_number.type, new_cc_number.type); |
| 786 EXPECT_EQ(ASCIIToUTF16("4111111111111111"), | 788 EXPECT_EQ(ASCIIToUTF16("4111111111111111"), |
| 787 view->GetTextContentsOfInput(new_cc_number)); | 789 view->GetTextContentsOfInput(new_cc_number)); |
| 788 | 790 |
| 789 EXPECT_NE(ASCIIToUTF16("shipping name"), | 791 EXPECT_NE(ASCIIToUTF16("shipping name"), |
| 790 view->GetTextContentsOfInput(shipping_zip)); | 792 view->GetTextContentsOfInput(shipping_zip)); |
| 791 } | 793 } |
| 792 #endif // defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) | 794 #endif // defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) |
| 793 | 795 |
| 794 } // namespace autofill | 796 } // namespace autofill |
| OLD | NEW |