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

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

Issue 331593008: Only consider PasswordFromManager which HasCompletedMatching when provisionally saving passwords (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added missing copyright notice in the JavaScript file Created 6 years, 5 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/between_parsing_and_rendering.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 a3b9373b584fc8c4686c5d878189492e9d15dbec..d86b582610c82c71a3bd7c54efd9daa7ae38aefd 100644
--- a/chrome/browser/password_manager/password_manager_browsertest.cc
+++ b/chrome/browser/password_manager/password_manager_browsertest.cc
@@ -1099,3 +1099,27 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoLastLoadGoodLastLoad) {
run_loop.RunUntilIdle();
EXPECT_FALSE(password_store->IsEmpty());
}
+
+// In some situations, multiple PasswordFormManager instances from
+// PasswordManager::pending_login_managers_ would match (via DoesManage) a form
+// to be provisionally saved. One of them might be a complete match, the other
+// all-but-action match. Normally, the former should be preferred, but if the
+// former has not finished matching, and the latter has, the latter should be
+// used (otherwise we'd give up even though we could have saved the password).
+IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
+ PreferPasswordFormManagerWhichFinishedMatching) {
+ NavigateToFile("/password/create_form_copy_on_submit.html");
+
+ NavigationObserver observer(WebContents());
+ scoped_ptr<PromptObserver> prompt_observer(
+ PromptObserver::Create(WebContents()));
+ std::string submit =
+ "document.getElementById('username').value = 'overwrite_me';"
+ "document.getElementById('password').value = 'random';"
+ "document.getElementById('non-form-button').click();";
+ ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), submit));
+ observer.Wait();
+
+ EXPECT_TRUE(prompt_observer->IsShowingPrompt());
+}
+
« no previous file with comments | « no previous file | chrome/test/data/password/between_parsing_and_rendering.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698