The test PasswordManagerBrowserTest.PasswordValueAccessible in chrome/browser/password_manager/password_manager_browsertest.cc has been flaky recently (
http://crbug.com/346297).
The reason, given local testing with log messages, seems to be the following sequence:
content::SimulateMouseClick(
WebContents(), 0, blink::WebMouseEvent::ButtonLeft);
/* ... */
CheckScriptReturnValue(check_password, true);
In there, the simulated mouse click is supposed to have an effect on the page's DOM, and the javascript code then verifies the effect. The problem is that the SimulatedMouseClick seems to get delayed. More precisely, the call to WebViewImpl::handleInputEvent associated to the simulated script is done after the script finishes.
My question: what should I wait for to make sure the simulated click is processed before the script?
I tried so far content::RunAllPendingInMessageLoop() (no effect), and also waiting for NOTIFICATION_FOCUS_CHANGED_IN_PAGE. The focus change notification did not seem to be fired even when I manually clicked in the test browser window and changed focus to various elements on the page.
Any advice welcome. :)
Thanks,
Vaclav