Chromium Code Reviews| 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 b04c72f336097767e5ffdb1e3525fe8a3f110e18..e4f811be5b89480a83173a9ffea3e9d99b661330 100644 |
| --- a/chrome/browser/password_manager/password_manager_browsertest.cc |
| +++ b/chrome/browser/password_manager/password_manager_browsertest.cc |
| @@ -1845,3 +1845,44 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, |
| // Wait until that interaction causes the password value to be revealed. |
| WaitForElementValue("password", "mypassword"); |
| } |
| + |
| +// Check that we can fill in cases where <base href> is set and the action of |
| +// the form is empty. Regression test for https://crbug.com/360230. |
|
engedy
2015/04/01 19:06:24
We should mention the form not having an action at
Garrett Casto
2015/04/01 23:59:29
Yeah, that wording is confusing. I meant the same
|
| +IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, BaseTagWithEmptyActionTest) { |
| + password_manager::TestPasswordStore* password_store = |
| + static_cast<password_manager::TestPasswordStore*>( |
| + PasswordStoreFactory::GetForProfile( |
| + browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get()); |
| + |
| + EXPECT_TRUE(password_store->IsEmpty()); |
| + |
| + NavigateToFile("/password/password_xhr_submit.html"); |
| + |
| + NavigationObserver observer(WebContents()); |
| + scoped_ptr<PromptObserver> prompt_observer( |
| + PromptObserver::Create(WebContents())); |
| + std::string submit = |
| + "document.getElementById('username_field').value = 'myusername';" |
| + "document.getElementById('password_field').value = 'mypassword';" |
| + "document.getElementById('submit_button').click();"; |
| + ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), submit)); |
| + observer.Wait(); |
| + |
| + prompt_observer->Accept(); |
| + |
| + // Spin the message loop to make sure the password store had a chance to save |
| + // the password. |
| + base::RunLoop run_loop; |
|
engedy
2015/04/01 19:06:24
nit: Although the current solution is consistent w
Garrett Casto
2015/04/01 23:59:29
Sounds good.
|
| + run_loop.RunUntilIdle(); |
| + EXPECT_FALSE(password_store->IsEmpty()); |
| + |
| + NavigateToFile("/password/password_xhr_submit.html"); |
| + |
| + // Let the user interact with the page, so that DOM gets modification events, |
| + // needed for autofilling fields. |
| + content::SimulateMouseClickAt( |
| + WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1)); |
| + |
| + // Wait until that interaction causes the password value to be revealed. |
| + WaitForElementValue("password_field", "mypassword"); |
| +} |