Index: chrome/browser/password_manager/password_manager_browsertest.cc |
diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc |
index 6a1f0b8c3d1bf7a86ea39317e89351d79a8fa5a4..a58efce2f27e8b165e0e3b8a51fb8a902e7a20fd 100644 |
--- a/chrome/browser/password_manager/password_manager_browsertest.cc |
+++ b/chrome/browser/password_manager/password_manager_browsertest.cc |
@@ -251,18 +251,28 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, |
EXPECT_TRUE(prompt_observer->IsShowingPrompt()); |
} |
-// Flaky: crbug.com/301547, observed on win and mac. Probably happens on all |
-// platforms. |
-IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, |
- DISABLED_PromptForDynamicForm) { |
+IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, PromptForDynamicForm) { |
NavigateToFile("/password/dynamic_password_form.html"); |
+ std::string create_form = |
+ "document.getElementById('create_form_button').click();"; |
+ ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), create_form)); |
+ |
vabr (Chromium)
2015/08/07 07:47:58
Would inserting
base::RunLoop run_loop;
run_lo
|
+ // Issue an artificial PasswordStore::GetLogins() request and wait until the |
+ // store returns a response. Hopefully, at that point, the PasswordFormManager |
+ // created for the new form above will have received and processed the store's |
+ // response as well. |
+ scoped_refptr<password_manager::PasswordStore> password_store = |
+ PasswordStoreFactory::GetForProfile( |
+ browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get(); |
+ DummyStoreConsumer store_consumer; |
+ store_consumer.RequestLoginsAndWait(password_store); |
+ |
// Fill the dynamic password form and submit. |
NavigationObserver observer(WebContents()); |
scoped_ptr<PromptObserver> prompt_observer( |
PromptObserver::Create(WebContents())); |
std::string fill_and_submit = |
- "document.getElementById('create_form_button').click();" |
"window.setTimeout(function() {" |
" document.dynamic_form.username.value = 'tempro';" |
" document.dynamic_form.password.value = 'random';" |
@@ -1412,24 +1422,36 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, |
// Test that if a form gets autofilled, then it gets autofilled on re-creation |
// as well. |
-// TODO(vabr): This is flaky everywhere. http://crbug.com/442704 |
IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, |
- DISABLED_ReCreatedFormsGetFilled) { |
+ ReCreatedFormsGetFilled) { |
NavigateToFile("/password/dynamic_password_form.html"); |
+ std::string create_form = |
+ "document.getElementById('create_form_button').click();"; |
+ ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), create_form)); |
+ |
+ // Issue an artificial PasswordStore::GetLogins() request and wait until the |
+ // store returns a response. Hopefully, at that point, the PasswordFormManager |
+ // created for the new form above will have received and processed the store's |
+ // response as well. |
+ scoped_refptr<password_manager::PasswordStore> password_store = |
+ PasswordStoreFactory::GetForProfile( |
+ browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get(); |
+ DummyStoreConsumer store_consumer; |
+ store_consumer.RequestLoginsAndWait(password_store); |
+ |
// Fill in the credentials, and make sure they are saved. |
NavigationObserver form_submit_observer(WebContents()); |
scoped_ptr<PromptObserver> prompt_observer( |
PromptObserver::Create(WebContents())); |
- std::string create_fill_and_submit = |
- "document.getElementById('create_form_button').click();" |
+ std::string fill_and_submit = |
"window.setTimeout(function() {" |
" var form = document.getElementById('dynamic_form_id');" |
" form.username.value = 'temp';" |
" form.password.value = 'random';" |
" form.submit();" |
"}, 0)"; |
- ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), create_fill_and_submit)); |
+ ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); |
form_submit_observer.Wait(); |
EXPECT_TRUE(prompt_observer->IsShowingPrompt()); |
prompt_observer->Accept(); |
@@ -1438,8 +1460,6 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, |
NavigationObserver reload_observer(WebContents()); |
NavigateToFile("/password/dynamic_password_form.html"); |
reload_observer.Wait(); |
- std::string create_form = |
- "document.getElementById('create_form_button').click();"; |
ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), create_form)); |
// Wait until the username is filled, to make sure autofill kicked in. |
WaitForElementValue("username_id", "temp"); |