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

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

Issue 902893003: Do not save passwords after back-navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just rebased Created 5 years, 10 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/dummy_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 63ad1204d1807210ca3033a0868c8bb3ea3311f5..d4243ffccb2453f8def23e8ab1d0d1b62d3d20d2 100644
--- a/chrome/browser/password_manager/password_manager_browsertest.cc
+++ b/chrome/browser/password_manager/password_manager_browsertest.cc
@@ -1583,3 +1583,35 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
observer.Wait();
EXPECT_FALSE(prompt_observer->IsShowingPrompt());
}
+
+IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoPromptOnBack) {
+ // Go to a successful landing page through submitting first, so that it is
+ // reachable through going back, and the remembered page transition is form
+ // submit. There is no need to submit non-empty strings.
+ NavigateToFile("/password/password_form.html");
+
+ NavigationObserver dummy_submit_observer(WebContents());
+ std::string just_submit =
+ "document.getElementById('input_submit_button').click()";
+ ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), just_submit));
+ dummy_submit_observer.Wait();
+
+ // Now go to a page with a form again, fill the form, and go back instead of
+ // submitting it.
+ NavigateToFile("/password/dummy_submit.html");
+
+ NavigationObserver observer(WebContents());
+ scoped_ptr<PromptObserver> prompt_observer(
+ PromptObserver::Create(WebContents()));
+ // The (dummy) submit is necessary to provisionally save the typed password. A
+ // user typing in the password field would not need to submit to provisionally
+ // save it, but the script cannot trigger that just by assigning to the
+ // field's value.
+ std::string fill_and_back =
+ "document.getElementById('password_field').value = 'random';"
+ "document.getElementById('input_submit_button').click();"
+ "window.history.back();";
+ ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_back));
+ observer.Wait();
+ EXPECT_FALSE(prompt_observer->IsShowingPrompt());
+}
« no previous file with comments | « no previous file | chrome/test/data/password/dummy_submit.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698