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