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

Side by Side Diff: chrome/renderer/autofill/password_autofill_agent_browsertest.cc

Issue 2893633002: [Password Manager] Make filling robust against changing url by JavaScript (Closed)
Patch Set: fix merge Created 3 years, 7 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 | components/autofill/content/renderer/password_autofill_agent.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/autofill/content/renderer/password_autofill_agent.h" 5 #include "components/autofill/content/renderer/password_autofill_agent.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 2895 matching lines...) Expand 10 before | Expand all | Expand 10 after
2906 EXPECT_EQ(1, fake_driver_.called_check_safe_browsing_reputation_cnt()); 2906 EXPECT_EQ(1, fake_driver_.called_check_safe_browsing_reputation_cnt());
2907 2907
2908 // Navigate to another page and click on username field, 2908 // Navigate to another page and click on username field,
2909 // CheckSafeBrowsingReputation() should be triggered again. 2909 // CheckSafeBrowsingReputation() should be triggered again.
2910 LoadHTML(kFormHTML); 2910 LoadHTML(kFormHTML);
2911 SimulateElementClick(kUsernameName); 2911 SimulateElementClick(kUsernameName);
2912 base::RunLoop().RunUntilIdle(); 2912 base::RunLoop().RunUntilIdle();
2913 EXPECT_EQ(2, fake_driver_.called_check_safe_browsing_reputation_cnt()); 2913 EXPECT_EQ(2, fake_driver_.called_check_safe_browsing_reputation_cnt());
2914 } 2914 }
2915 #endif 2915 #endif
2916
2917 // Tests that username/password are autofilled when JavaScript is changing url
2918 // between discovering a form and receving credentials from the browser process.
2919 TEST_F(PasswordAutofillAgentTest, AutocompleteWhenPageUrlIsChanged) {
2920 // Simulate that JavaScript changes url.
2921 fill_data_.origin = GURL(fill_data_.origin.possibly_invalid_spec() + "/path");
2922
2923 SimulateOnFillPasswordForm(fill_data_);
2924
2925 // The username and password should have been autocompleted.
2926 CheckTextFieldsState(kAliceUsername, true, kAlicePassword, true);
2927 }
2916 } // namespace autofill 2928 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/content/renderer/password_autofill_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698