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 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 // save it, but the script cannot trigger that just by assigning to the | 1608 // save it, but the script cannot trigger that just by assigning to the |
1609 // field's value. | 1609 // field's value. |
1610 std::string fill_and_back = | 1610 std::string fill_and_back = |
1611 "document.getElementById('password_field').value = 'random';" | 1611 "document.getElementById('password_field').value = 'random';" |
1612 "document.getElementById('input_submit_button').click();" | 1612 "document.getElementById('input_submit_button').click();" |
1613 "window.history.back();"; | 1613 "window.history.back();"; |
1614 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_back)); | 1614 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_back)); |
1615 observer.Wait(); | 1615 observer.Wait(); |
1616 EXPECT_FALSE(prompt_observer->IsShowingPrompt()); | 1616 EXPECT_FALSE(prompt_observer->IsShowingPrompt()); |
1617 } | 1617 } |
| 1618 |
| 1619 // Regression test for http://crbug.com/452306 |
| 1620 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, |
| 1621 ChangingTextToPasswordFieldOnSignupForm) { |
| 1622 NavigateToFile("/password/signup_form.html"); |
| 1623 |
| 1624 // In this case, pretend that username_field is actually a password field |
| 1625 // that starts as a text field to simulate placeholder. |
| 1626 NavigationObserver observer(WebContents()); |
| 1627 scoped_ptr<PromptObserver> prompt_observer( |
| 1628 PromptObserver::Create(WebContents())); |
| 1629 std::string change_and_submit = |
| 1630 "document.getElementById('other_info').value = 'username';" |
| 1631 "document.getElementById('username_field').type = 'password';" |
| 1632 "document.getElementById('username_field').value = 'mypass';" |
| 1633 "document.getElementById('password_field').value = 'mypass';" |
| 1634 "document.getElementById('testform').submit();"; |
| 1635 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), change_and_submit)); |
| 1636 observer.Wait(); |
| 1637 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); |
| 1638 } |
| 1639 |
| 1640 // Regression test for http://crbug.com/451631 |
| 1641 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, |
| 1642 SavingOnManyPasswordFieldsTest) { |
| 1643 // Simulate Macy's registration page, which contains the normal 2 password |
| 1644 // fields for confirming the new password plus 2 more fields for security |
| 1645 // questions and credit card. Make sure that saving works correctly for such |
| 1646 // sites. |
| 1647 NavigateToFile("/password/many_password_signup_form.html"); |
| 1648 |
| 1649 NavigationObserver observer(WebContents()); |
| 1650 scoped_ptr<PromptObserver> prompt_observer( |
| 1651 PromptObserver::Create(WebContents())); |
| 1652 std::string fill_and_submit = |
| 1653 "document.getElementById('username_field').value = 'username';" |
| 1654 "document.getElementById('password_field').value = 'mypass';" |
| 1655 "document.getElementById('confirm_field').value = 'mypass';" |
| 1656 "document.getElementById('security_answer').value = 'hometown';" |
| 1657 "document.getElementById('SSN').value = '1234';" |
| 1658 "document.getElementById('testform').submit();"; |
| 1659 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); |
| 1660 observer.Wait(); |
| 1661 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); |
| 1662 } |
OLD | NEW |