OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |