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

Side by Side Diff: chrome/browser/password_manager/password_manager_browsertest.cc

Issue 1072813002: Avoid considering readonly password elements in password form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted comment length to contain within 80 chars Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/password/password_form_with_password_readonly.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_samples.h" 8 #include "base/metrics/histogram_samples.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 // it's not coming from the user. 1182 // it's not coming from the user.
1183 NavigationObserver observer(WebContents()); 1183 NavigationObserver observer(WebContents());
1184 scoped_ptr<PromptObserver> prompt_observer( 1184 scoped_ptr<PromptObserver> prompt_observer(
1185 PromptObserver::Create(WebContents())); 1185 PromptObserver::Create(WebContents()));
1186 NavigateToFile("/password/done.html"); 1186 NavigateToFile("/password/done.html");
1187 observer.Wait(); 1187 observer.Wait();
1188 EXPECT_FALSE(prompt_observer->IsShowingPrompt()); 1188 EXPECT_FALSE(prompt_observer->IsShowingPrompt());
1189 } 1189 }
1190 1190
1191 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, 1191 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
1192 DontPromptForPasswordFormWithReadonlyPasswordField) {
1193 NavigateToFile("/password/password_form_with_password_readonly.html");
1194
1195 // Fill a form and submit through a <input type="submit"> button. Nothing
1196 // special.
1197 NavigationObserver observer(WebContents());
1198 scoped_ptr<PromptObserver> prompt_observer(
1199 PromptObserver::Create(WebContents()));
1200 std::string fill_and_submit =
1201 "document.getElementById('username_field').value = 'temp';"
1202 "document.getElementById('password_field').value = 'random';"
1203 "document.getElementById('input_submit_button').click()";
1204 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit));
1205 observer.Wait();
1206 EXPECT_FALSE(prompt_observer->IsShowingPrompt());
1207 }
1208
1209 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
1192 PromptWhenEnableAutomaticPasswordSavingSwitchIsNotSet) { 1210 PromptWhenEnableAutomaticPasswordSavingSwitchIsNotSet) {
1193 NavigateToFile("/password/password_form.html"); 1211 NavigateToFile("/password/password_form.html");
1194 1212
1195 // Fill a form and submit through a <input type="submit"> button. 1213 // Fill a form and submit through a <input type="submit"> button.
1196 NavigationObserver observer(WebContents()); 1214 NavigationObserver observer(WebContents());
1197 scoped_ptr<PromptObserver> prompt_observer( 1215 scoped_ptr<PromptObserver> prompt_observer(
1198 PromptObserver::Create(WebContents())); 1216 PromptObserver::Create(WebContents()));
1199 std::string fill_and_submit = 1217 std::string fill_and_submit =
1200 "document.getElementById('username_field').value = 'temp';" 1218 "document.getElementById('username_field').value = 'temp';"
1201 "document.getElementById('password_field').value = 'random';" 1219 "document.getElementById('password_field').value = 'random';"
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 NavigateToFile("/password/password_xhr_submit.html"); 1897 NavigateToFile("/password/password_xhr_submit.html");
1880 1898
1881 // Let the user interact with the page, so that DOM gets modification events, 1899 // Let the user interact with the page, so that DOM gets modification events,
1882 // needed for autofilling fields. 1900 // needed for autofilling fields.
1883 content::SimulateMouseClickAt( 1901 content::SimulateMouseClickAt(
1884 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1)); 1902 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1));
1885 1903
1886 // Wait until that interaction causes the password value to be revealed. 1904 // Wait until that interaction causes the password value to be revealed.
1887 WaitForElementValue("password_field", "mypassword"); 1905 WaitForElementValue("password_field", "mypassword");
1888 } 1906 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/password/password_form_with_password_readonly.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698