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

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

Issue 2055693002: Add delay to didAssociateFormControlsTimer so it doesn't fire too frequently (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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 44964164c1ae9b1e2aacfc660c0d4cbb46fb5690..acd14925db7b0ca5d8f042363f605f40ac8dc98b 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);
};
@@ -165,3 +181,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