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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 1297 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
1298 ASSERT_NE(dialog_invoker, GetActiveWebContents()); | 1298 ASSERT_NE(dialog_invoker, GetActiveWebContents()); |
1299 | 1299 |
1300 // Closing the tab opened by "Manage my shipping details..." should refresh | 1300 // Closing the tab opened by "Manage my shipping details..." should refresh |
1301 // the dialog. | 1301 // the dialog. |
1302 controller()->ClearLastWalletItemsFetchTimestampForTesting(); | 1302 controller()->ClearLastWalletItemsFetchTimestampForTesting(); |
1303 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetWalletItems()); | 1303 EXPECT_CALL(*controller()->GetTestingWalletClient(), GetWalletItems()); |
1304 GetActiveWebContents()->Close(); | 1304 GetActiveWebContents()->Close(); |
1305 } | 1305 } |
1306 | 1306 |
| 1307 // Changes from Wallet to Autofill and verifies that the combined billing/cc |
| 1308 // sections are showing (or not) at the correct times. |
| 1309 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, |
| 1310 ChangingDataSourceShowsCorrectSections) { |
| 1311 scoped_ptr<AutofillDialogViewTester> view = GetViewTester(); |
| 1312 EXPECT_TRUE(view->IsShowingSection(SECTION_CC)); |
| 1313 EXPECT_TRUE(view->IsShowingSection(SECTION_BILLING)); |
| 1314 EXPECT_FALSE(view->IsShowingSection(SECTION_CC_BILLING)); |
| 1315 |
| 1316 // Switch the dialog to paying with Wallet. |
| 1317 controller()->OnDidFetchWalletCookieValue(std::string()); |
| 1318 controller()->OnDidGetWalletItems( |
| 1319 wallet::GetTestWalletItems(wallet::AMEX_DISALLOWED)); |
| 1320 ASSERT_TRUE(controller()->IsPayingWithWallet()); |
| 1321 |
| 1322 EXPECT_FALSE(view->IsShowingSection(SECTION_CC)); |
| 1323 EXPECT_FALSE(view->IsShowingSection(SECTION_BILLING)); |
| 1324 EXPECT_TRUE(view->IsShowingSection(SECTION_CC_BILLING)); |
| 1325 |
| 1326 // Now switch back to Autofill to ensure this direction works as well. |
| 1327 ui::MenuModel* account_chooser = controller()->MenuModelForAccountChooser(); |
| 1328 account_chooser->ActivatedAt(account_chooser->GetItemCount() - 1); |
| 1329 |
| 1330 EXPECT_TRUE(view->IsShowingSection(SECTION_CC)); |
| 1331 EXPECT_TRUE(view->IsShowingSection(SECTION_BILLING)); |
| 1332 EXPECT_FALSE(view->IsShowingSection(SECTION_CC_BILLING)); |
| 1333 } |
| 1334 |
1307 // http://crbug.com/318526 | 1335 // http://crbug.com/318526 |
1308 #if defined(OS_MACOSX) | 1336 #if defined(OS_MACOSX) |
1309 #define MAYBE_DoesWorkOnHttpWithFlag DISABLED_DoesWorkOnHttpWithFlag | 1337 #define MAYBE_DoesWorkOnHttpWithFlag DISABLED_DoesWorkOnHttpWithFlag |
1310 #else | 1338 #else |
1311 #define MAYBE_DoesWorkOnHttpWithFlag DoesWorkOnHttpWithFlag | 1339 #define MAYBE_DoesWorkOnHttpWithFlag DoesWorkOnHttpWithFlag |
1312 #endif | 1340 #endif |
1313 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, | 1341 IN_PROC_BROWSER_TEST_F(AutofillDialogControllerTest, |
1314 MAYBE_DoesWorkOnHttpWithFlag) { | 1342 MAYBE_DoesWorkOnHttpWithFlag) { |
1315 net::SpawnedTestServer http_server( | 1343 net::SpawnedTestServer http_server( |
1316 net::SpawnedTestServer::TYPE_HTTP, | 1344 net::SpawnedTestServer::TYPE_HTTP, |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 // Relevant country loaded but revalidation already happened, no further | 1634 // Relevant country loaded but revalidation already happened, no further |
1607 // validation should occur. | 1635 // validation should occur. |
1608 controller()->OnAddressValidationRulesLoaded("CN", false); | 1636 controller()->OnAddressValidationRulesLoaded("CN", false); |
1609 | 1637 |
1610 // Cancelling the dialog causes additional validation to see if the user | 1638 // Cancelling the dialog causes additional validation to see if the user |
1611 // cancelled with invalid fields, so verify and clear here. | 1639 // cancelled with invalid fields, so verify and clear here. |
1612 testing::Mock::VerifyAndClearExpectations(controller()->GetMockValidator()); | 1640 testing::Mock::VerifyAndClearExpectations(controller()->GetMockValidator()); |
1613 } | 1641 } |
1614 | 1642 |
1615 } // namespace autofill | 1643 } // namespace autofill |
OLD | NEW |