Index: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc |
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc |
index 00b17ffde6d9e2730087e6fd88b7154b05896d66..107e2f0e5e8706c89c69c36cf13bdc495bf3f242 100644 |
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc |
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc |
@@ -271,6 +271,13 @@ class TestAutofillDialogController |
OnWalletSigninError(); |
} |
+ // Skips past the 2 second wait between FinishSubmit and DoFinishSubmit. |
+ void ForceFinishSubmit() { |
+#if defined(TOOLKIT_VIEWS) |
+ DoFinishSubmit(); |
+#endif |
+ } |
+ |
MOCK_METHOD0(LoadRiskFingerprintData, void()); |
using AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData; |
using AutofillDialogControllerImpl::IsEditingExistingData; |
@@ -1900,13 +1907,11 @@ TEST_F(AutofillDialogControllerTest, SubmitWithSigninErrorDoesntSetPref) { |
::prefs::kAutofillDialogPayWithoutWallet)); |
} |
-// Tests that there's an overlay shown while waiting for full wallet items, |
-// and on first run an additional expository wallet overlay shown after full |
-// wallet items are returned. |
+// Tests that there's an overlay shown while waiting for full wallet items. |
// TODO(estade): enable on other platforms when overlays are supported there. |
#if defined(TOOLKIT_VIEWS) |
TEST_F(AutofillDialogControllerTest, WalletFirstRun) { |
- // Simulate first run. |
+ // Simulate fist run. |
PrefService* prefs = profile()->GetPrefs(); |
prefs->SetBoolean(::prefs::kAutofillDialogHasPaidWithWallet, false); |
SetUpControllerWithFormData(DefaultFormData()); |
@@ -1923,28 +1928,12 @@ TEST_F(AutofillDialogControllerTest, WalletFirstRun) { |
EXPECT_FALSE(controller()->GetDialogOverlay().image.IsEmpty()); |
EXPECT_FALSE(form_structure()); |
- controller()->OverlayButtonPressed(); |
- EXPECT_TRUE(prefs->GetBoolean(::prefs::kAutofillDialogHasPaidWithWallet)); |
+ // Don't wait for 2 seconds. |
+ controller()->ForceFinishSubmit(); |
EXPECT_TRUE(form_structure()); |
} |
#endif |
-// On second run, the second overlay doesn't show. |
-TEST_F(AutofillDialogControllerTest, WalletSecondRun) { |
- SwitchToWallet(); |
- EXPECT_TRUE(controller()->GetDialogOverlay().image.IsEmpty()); |
- |
- SubmitWithWalletItems(CompleteAndValidWalletItems()); |
- EXPECT_FALSE(controller()->GetDialogOverlay().image.IsEmpty()); |
- |
- EXPECT_TRUE(profile()->GetPrefs()->GetBoolean( |
- ::prefs::kAutofillDialogHasPaidWithWallet)); |
- controller()->OnDidGetFullWallet(wallet::GetTestFullWallet()); |
- EXPECT_TRUE(profile()->GetPrefs()->GetBoolean( |
- ::prefs::kAutofillDialogHasPaidWithWallet)); |
- EXPECT_TRUE(form_structure()); |
-} |
- |
TEST_F(AutofillDialogControllerTest, ViewSubmitSetsPref) { |
ASSERT_FALSE(profile()->GetPrefs()->HasPrefPath( |
::prefs::kAutofillDialogPayWithoutWallet)); |
@@ -1984,6 +1973,7 @@ TEST_F(AutofillDialogControllerTest, ViewSubmitSetsPref) { |
controller()->OnDidGetWalletItems(wallet_items.Pass()); |
controller()->OnAccept(); |
controller()->OnDidGetFullWallet(wallet::GetTestFullWallet()); |
+ controller()->ForceFinishSubmit(); |
EXPECT_TRUE(profile()->GetPrefs()->HasPrefPath( |
::prefs::kAutofillDialogPayWithoutWallet)); |
@@ -2014,7 +2004,9 @@ TEST_F(AutofillDialogControllerTest, HideWalletEmail) { |
controller()->OnAccept(); |
controller()->OnDidGetFullWallet(wallet::GetTestFullWallet()); |
+ controller()->ForceFinishSubmit(); |
+ ASSERT_TRUE(form_structure()); |
size_t i = 0; |
for (; i < form_structure()->field_count(); ++i) { |
if (form_structure()->field(i)->Type().GetStorableType() == EMAIL_ADDRESS) { |
@@ -2031,6 +2023,8 @@ TEST_F(AutofillDialogControllerTest, AutofillTypes) { |
controller()->OnDidGetWalletItems(CompleteAndValidWalletItems()); |
controller()->OnAccept(); |
controller()->OnDidGetFullWallet(wallet::GetTestFullWallet()); |
+ controller()->ForceFinishSubmit(); |
+ ASSERT_TRUE(form_structure()); |
ASSERT_EQ(20U, form_structure()->field_count()); |
EXPECT_EQ(EMAIL_ADDRESS, |
form_structure()->field(0)->Type().GetStorableType()); |
@@ -2192,6 +2186,7 @@ TEST_F(AutofillDialogControllerTest, ShippingSectionCanBeHiddenForWallet) { |
wallet_items->AddInstrument(wallet::GetTestMaskedInstrument()); |
SubmitWithWalletItems(wallet_items.Pass()); |
controller()->OnDidGetFullWallet(wallet::GetTestFullWalletInstrumentOnly()); |
+ controller()->ForceFinishSubmit(); |
EXPECT_TRUE(form_structure()); |
} |
@@ -2280,6 +2275,7 @@ TEST_F(AutofillDialogControllerTest, GeneratedCardBubbleShown) { |
SubmitWithWalletItems(CompleteAndValidWalletItems()); |
controller()->OnDidGetFullWallet(wallet::GetTestFullWallet()); |
+ controller()->ForceFinishSubmit(); |
controller()->ViewClosed(); |
EXPECT_EQ(0, mock_new_card_bubble_controller()->bubbles_shown()); |