| 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 2079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2090 AutofillProfile full_profile(test::GetVerifiedProfile()); | 2090 AutofillProfile full_profile(test::GetVerifiedProfile()); |
| 2091 controller()->GetTestingManager()->AddTestingProfile(&full_profile); | 2091 controller()->GetTestingManager()->AddTestingProfile(&full_profile); |
| 2092 SetUpControllerWithFormData(form_data); | 2092 SetUpControllerWithFormData(form_data); |
| 2093 EXPECT_FALSE(controller()->SectionIsActive(SECTION_SHIPPING)); | 2093 EXPECT_FALSE(controller()->SectionIsActive(SECTION_SHIPPING)); |
| 2094 | 2094 |
| 2095 FillCreditCardInputs(); | 2095 FillCreditCardInputs(); |
| 2096 controller()->OnAccept(); | 2096 controller()->OnAccept(); |
| 2097 EXPECT_TRUE(form_structure()); | 2097 EXPECT_TRUE(form_structure()); |
| 2098 } | 2098 } |
| 2099 | 2099 |
| 2100 TEST_F(AutofillDialogControllerTest, ShippingSectionCanBeHiddenForWallet) { |
| 2101 SwitchToWallet(); |
| 2102 |
| 2103 FormFieldData email_field; |
| 2104 email_field.autocomplete_attribute = "email"; |
| 2105 FormFieldData cc_field; |
| 2106 cc_field.autocomplete_attribute = "cc-number"; |
| 2107 FormFieldData billing_field; |
| 2108 billing_field.autocomplete_attribute = "billing region"; |
| 2109 |
| 2110 FormData form_data; |
| 2111 form_data.fields.push_back(email_field); |
| 2112 form_data.fields.push_back(cc_field); |
| 2113 form_data.fields.push_back(billing_field); |
| 2114 |
| 2115 SetUpControllerWithFormData(form_data); |
| 2116 EXPECT_FALSE(controller()->SectionIsActive(SECTION_SHIPPING)); |
| 2117 EXPECT_FALSE(controller()->IsShippingAddressRequired()); |
| 2118 |
| 2119 EXPECT_CALL(*controller()->GetTestingWalletClient(), |
| 2120 GetFullWallet(_)).Times(1); |
| 2121 scoped_ptr<wallet::WalletItems> wallet_items = wallet::GetTestWalletItems(); |
| 2122 wallet_items->AddInstrument(wallet::GetTestMaskedInstrument()); |
| 2123 SubmitWithWalletItems(wallet_items.Pass()); |
| 2124 controller()->OnDidGetFullWallet(wallet::GetTestFullWalletInstrumentOnly()); |
| 2125 EXPECT_TRUE(form_structure()); |
| 2126 } |
| 2127 |
| 2100 TEST_F(AutofillDialogControllerTest, NotProdNotification) { | 2128 TEST_F(AutofillDialogControllerTest, NotProdNotification) { |
| 2101 // To make IsPayingWithWallet() true. | 2129 // To make IsPayingWithWallet() true. |
| 2102 controller()->OnDidGetWalletItems(wallet::GetTestWalletItems()); | 2130 controller()->OnDidGetWalletItems(wallet::GetTestWalletItems()); |
| 2103 | 2131 |
| 2104 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 2132 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 2105 ASSERT_FALSE(command_line->HasSwitch(switches::kWalletServiceUseProd)); | 2133 ASSERT_FALSE(command_line->HasSwitch(switches::kWalletServiceUseProd)); |
| 2106 EXPECT_FALSE( | 2134 EXPECT_FALSE( |
| 2107 NotificationsOfType(DialogNotification::DEVELOPER_WARNING).empty()); | 2135 NotificationsOfType(DialogNotification::DEVELOPER_WARNING).empty()); |
| 2108 | 2136 |
| 2109 command_line->AppendSwitch(switches::kWalletServiceUseProd); | 2137 command_line->AppendSwitch(switches::kWalletServiceUseProd); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2278 EXPECT_CALL(*test_bubble_controller(), | 2306 EXPECT_CALL(*test_bubble_controller(), |
| 2279 ShowAsGeneratedCardBubble(_, _)).Times(1); | 2307 ShowAsGeneratedCardBubble(_, _)).Times(1); |
| 2280 EXPECT_CALL(*test_bubble_controller(), ShowAsNewCardSavedBubble(_)).Times(0); | 2308 EXPECT_CALL(*test_bubble_controller(), ShowAsNewCardSavedBubble(_)).Times(0); |
| 2281 | 2309 |
| 2282 SubmitWithWalletItems(CompleteAndValidWalletItems()); | 2310 SubmitWithWalletItems(CompleteAndValidWalletItems()); |
| 2283 controller()->OnDidGetFullWallet(wallet::GetTestFullWallet()); | 2311 controller()->OnDidGetFullWallet(wallet::GetTestFullWallet()); |
| 2284 controller()->ViewClosed(); | 2312 controller()->ViewClosed(); |
| 2285 } | 2313 } |
| 2286 | 2314 |
| 2287 } // namespace autofill | 2315 } // namespace autofill |
| OLD | NEW |