Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1279)

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc

Issue 23717029: Disable submit button briefly when launching rAc dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use timer Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 1f88e9f20abf6aeab3e7a734214334bb107e6026..3186e0652ea9530a43dd3edd6446f09b47139599 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
@@ -288,6 +288,19 @@ class TestAutofillDialogController
#endif
}
+ void SimulateSubmitButtonDelayBegin() {
+ // 10 second delay to avoid test flakiness. The test would be flaky if this
+ // delay expired before the test finishes. This delay does not affect
+ // execution time of the test.
+ static const int kSimulatedSubmitButtonDelayMs = 10000;
+ AutofillDialogControllerImpl::SubmitButtonDelayBegin(
+ kSimulatedSubmitButtonDelayMs);
+ }
+
+ void SimulateSubmitButtonDelayEnd() {
+ AutofillDialogControllerImpl::OnSubmitButtonDelayEnd();
+ }
+
MOCK_METHOD0(LoadRiskFingerprintData, void());
using AutofillDialogControllerImpl::OnDidLoadRiskFingerprintData;
using AutofillDialogControllerImpl::IsEditingExistingData;
@@ -318,6 +331,14 @@ class TestAutofillDialogController
billing_profile.Pass());
}
+ virtual void SubmitButtonDelayBegin(int delay_ms) OVERRIDE {
Evan Stade 2013/09/04 21:42:52 You don't verify that production code ever calls t
please use gerrit instead 2013/09/05 02:30:58 I've overridden SubmitButtonDelayBegin() to increm
+ // Ignore in testing.
+ }
+
+ virtual void OnSubmitButtonDelayEnd() OVERRIDE {
+ // Ignore in testing.
+ }
+
private:
// To specify our own metric logger.
virtual const AutofillMetrics& GetMetricLogger() const OVERRIDE {
@@ -2391,4 +2412,12 @@ TEST_F(AutofillDialogControllerTest,
EXPECT_FALSE(controller()->ShouldSaveInChrome());
}
+TEST_F(AutofillDialogControllerTest, SubmitButtonDelayedOnStart) {
+ controller()->SimulateSubmitButtonDelayBegin();
+ SwitchToAutofill();
Evan Stade 2013/09/04 21:42:52 do you need this?
please use gerrit instead 2013/09/05 02:30:58 SwitchToAutofill() was to get rid of the wallet's
+ EXPECT_FALSE(controller()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
+ controller()->SimulateSubmitButtonDelayEnd();
+ EXPECT_TRUE(controller()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
+}
+
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698