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

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

Issue 944163003: [Password Manager] Fix password saving on Macys registration page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests Created 5 years, 9 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
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 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 std::string fill_and_submit = 1576 std::string fill_and_submit =
1577 "document.getElementById('chg_not_username_field').value = 'temp';" 1577 "document.getElementById('chg_not_username_field').value = 'temp';"
1578 "document.getElementById('chg_password_field').value = 'random';" 1578 "document.getElementById('chg_password_field').value = 'random';"
1579 "document.getElementById('chg_new_password_1').value = 'random1';" 1579 "document.getElementById('chg_new_password_1').value = 'random1';"
1580 "document.getElementById('chg_new_password_2').value = 'random1';" 1580 "document.getElementById('chg_new_password_2').value = 'random1';"
1581 "document.getElementById('chg_submit_button').click()"; 1581 "document.getElementById('chg_submit_button').click()";
1582 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); 1582 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit));
1583 observer.Wait(); 1583 observer.Wait();
1584 EXPECT_FALSE(prompt_observer->IsShowingPrompt()); 1584 EXPECT_FALSE(prompt_observer->IsShowingPrompt());
1585 } 1585 }
1586
1587 // Regression test for crbug.com/452306
vabr (Chromium) 2015/02/25 10:21:15 nit: Please add http:// to make the link clickable
Garrett Casto 2015/02/26 07:11:01 Done.
1588 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
1589 ChangingTextToPasswordFieldOnSignupForm) {
1590 NavigateToFile("/password/signup_form.html");
1591
1592 // In this case, pretend that username_field is actually a password field
1593 // that starts as a text field to simulate placeholder.
1594 NavigationObserver observer(WebContents());
1595 scoped_ptr<PromptObserver> prompt_observer(
1596 PromptObserver::Create(WebContents()));
1597 std::string change_and_submit =
1598 "document.getElementById('other_info').value = 'username';"
1599 "document.getElementById('username_field').type = 'password';"
1600 "document.getElementById('username_field').value = 'mypass';"
1601 "document.getElementById('password_field').value = 'mypass';"
1602 "document.getElementById('testform').submit();";
1603 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), change_and_submit));
1604 observer.Wait();
1605 EXPECT_TRUE(prompt_observer->IsShowingPrompt());
1606 }
1607
1608 // Regression test for crbug.com/451631
1609 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
1610 SavingOnManyPasswordFieldsTest) {
1611 // Simulate Macy's registration page, which contains the normal 2 password
1612 // fields for confirming the new password plus 2 more fields for security
1613 // questions and credit card. Make sure that saving works correctly for such
1614 // sites.
1615 NavigateToFile("/password/many_password_signup_form.html");
1616
1617 NavigationObserver observer(WebContents());
1618 scoped_ptr<PromptObserver> prompt_observer(
1619 PromptObserver::Create(WebContents()));
1620 std::string fill_and_submit =
1621 "document.getElementById('username_field').value = 'username';"
1622 "document.getElementById('password_field').value = 'mypass';"
1623 "document.getElementById('confirm_field').value = 'mypass';"
1624 "document.getElementById('security_answer').value = 'hometown';"
1625 "document.getElementById('SSN').value = '1234';"
1626 "document.getElementById('testform').submit();";
1627 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit));
1628 observer.Wait();
1629 EXPECT_TRUE(prompt_observer->IsShowingPrompt());
1630 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698