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

Unified Diff: chrome/test/base/chrome_render_view_test.cc

Issue 2134653002: Add delay to didAssociateFormControlsTimer so it doesn't fire too frequently (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 5 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
« no previous file with comments | « chrome/test/base/chrome_render_view_test.h ('k') | components/autofill/content/renderer/autofill_agent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/chrome_render_view_test.cc
diff --git a/chrome/test/base/chrome_render_view_test.cc b/chrome/test/base/chrome_render_view_test.cc
index 68994cc4d6f63fc973c6ec1d9f11466b48ff17b0..1db6f6390e4626954c728f853c34d51a58ae3b1d 100644
--- a/chrome/test/base/chrome_render_view_test.cc
+++ b/chrome/test/base/chrome_render_view_test.cc
@@ -69,9 +69,25 @@ class MockAutofillAgent : public AutofillAgent {
~MockAutofillAgent() override {}
+ void WaitForAutofillDidAssociateFormControl() {
+ DCHECK(run_loop_ == nullptr);
+ run_loop_.reset(new base::RunLoop);
+ run_loop_->Run();
+ run_loop_.reset();
+ }
+
MOCK_CONST_METHOD0(IsUserGesture, bool());
private:
+ void didAssociateFormControls(
+ const blink::WebVector<blink::WebNode>& nodes) override {
+ AutofillAgent::didAssociateFormControls(nodes);
+ if (run_loop_)
+ run_loop_->Quit();
+ }
+
+ std::unique_ptr<base::RunLoop> run_loop_;
+
DISALLOW_COPY_AND_ASSIGN(MockAutofillAgent);
};
@@ -160,3 +176,8 @@ void ChromeRenderViewTest::DisableUserGestureSimulationForAutofill() {
EXPECT_CALL(*(static_cast<MockAutofillAgent*>(autofill_agent_)),
IsUserGesture()).WillRepeatedly(Return(false));
}
+
+void ChromeRenderViewTest::WaitForAutofillDidAssociateFormControl() {
+ static_cast<MockAutofillAgent*>(autofill_agent_)
+ ->WaitForAutofillDidAssociateFormControl();
+}
« no previous file with comments | « chrome/test/base/chrome_render_view_test.h ('k') | components/autofill/content/renderer/autofill_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698