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

Unified Diff: chrome/browser/password_manager/password_manager_browsertest.cc

Issue 1039833002: [Password Manager] Unify action and origin detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test Created 5 years, 9 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 | « no previous file | chrome/test/data/password/password_xhr_submit.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..892ac14147fc894dcd05946fc6e03163f499cc8c 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 not set. Regression test for https://crbug.com/360230.
+IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, BaseTagWithNoActionTest) {
+ 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;
+ 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");
+}
« no previous file with comments | « no previous file | chrome/test/data/password/password_xhr_submit.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698