Commit be88a034 authored by abarth@chromium.org's avatar abarth@chromium.org

PasswordAutofillAgentTest.InlineAutocomplete depends on details of style recalc timing

This CL fixes an incorrect assumption in
PasswordAutofillAgentTest.InlineAutocomplete. Previously, this code assumed
that one trip through the event loop was sufficient to ensure that style was
recalcuated. After we move recalc style to be triggered by
requestAnimationFrame, this assumption will no longer be valid. This CL changes
the test to explicitly recalc style by calling WebView::layout.

Unfortunately, we cannot simply call WebView::layout in straight-line code
because this test does some of its work off the event loop. Instead, we need to
schedule the call to layout after we schedule the other async work.

BUG=337617
R=gcasto@chromium.org

Review URL: https://codereview.chromium.org/136003013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247590 0039d316-1c4b-4281-b951-d872f2087c98
parent c979d08a
...@@ -262,11 +262,23 @@ class PasswordAutofillAgentTest : public ChromeRenderViewTest { ...@@ -262,11 +262,23 @@ class PasswordAutofillAgentTest : public ChromeRenderViewTest {
if (move_caret_to_end) if (move_caret_to_end)
username_input.setSelectionRange(username.length(), username.length()); username_input.setSelectionRange(username.length(), username.length());
autofill_agent_->textFieldDidChange(username_input); autofill_agent_->textFieldDidChange(username_input);
// Processing is delayed because of a WebKit bug, see // Processing is delayed because of a Blink bug:
// PasswordAutocompleteManager::TextDidChangeInTextField() for details. // https://bugs.webkit.org/show_bug.cgi?id=16976
// See PasswordAutofillAgent::TextDidChangeInTextField() for details.
// Autocomplete will trigger a style recalculation when we put up the next
// frame, but we don't want to wait that long. Instead, trigger a style
// recalcuation manually after TextFieldDidChangeImpl runs.
base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
&PasswordAutofillAgentTest::LayoutMainFrame, base::Unretained(this)));
base::MessageLoop::current()->RunUntilIdle(); base::MessageLoop::current()->RunUntilIdle();
} }
void LayoutMainFrame() {
GetMainFrame()->view()->layout();
}
void SimulateUsernameChange(const std::string& username, void SimulateUsernameChange(const std::string& username,
bool move_caret_to_end) { bool move_caret_to_end) {
SimulateUsernameChangeForElement(username, move_caret_to_end, SimulateUsernameChangeForElement(username, move_caret_to_end,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment