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

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: Test added 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
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 b2b5b52d3366091e78c8ddb6ae596cf75c42bce8..92394666d9a5fb1ed733b82192d6acf92f585ab9 100644
--- a/chrome/browser/password_manager/password_manager_browsertest.cc
+++ b/chrome/browser/password_manager/password_manager_browsertest.cc
@@ -1083,3 +1083,29 @@ 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 did not finished matching, and the latter did, the latter should be
engedy 2014/07/11 17:05:35 nit: s/did/has/
vabr (Chromium) 2014/07/11 18:15:47 Done.
+// used (otherwise we'd give up even though we could have saved the password).
+IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
+ TryToUsePasswordFormManagerWhichFinishedMatching) {
engedy 2014/07/11 17:05:35 nit: s/TryToUse/Prefer/
vabr (Chromium) 2014/07/11 18:15:47 Done.
+ NavigateToFile("/password/create_form_copy_on_submit.html");
+
+ NavigationObserver observer(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();
+
+ if (ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled()) {
+ EXPECT_TRUE(ui_controller()->PasswordPendingUserDecision());
+ } else {
+ EXPECT_TRUE(observer.infobar_shown());
+ }
+}
+

Powered by Google App Engine
This is Rietveld 408576698