| 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 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2705 base::RunLoop().RunUntilIdle(); | 2705 base::RunLoop().RunUntilIdle(); |
| 2706 | 2706 |
| 2707 // Chect that the form was submitted with in-page navigation. | 2707 // Chect that the form was submitted with in-page navigation. |
| 2708 EXPECT_TRUE(fake_driver_.called_inpage_navigation()); | 2708 EXPECT_TRUE(fake_driver_.called_inpage_navigation()); |
| 2709 EXPECT_EQ(base::string16(), | 2709 EXPECT_EQ(base::string16(), |
| 2710 fake_driver_.password_form_inpage_navigation()->username_value); | 2710 fake_driver_.password_form_inpage_navigation()->username_value); |
| 2711 EXPECT_EQ(ASCIIToUTF16("random"), | 2711 EXPECT_EQ(ASCIIToUTF16("random"), |
| 2712 fake_driver_.password_form_inpage_navigation()->password_value); | 2712 fake_driver_.password_form_inpage_navigation()->password_value); |
| 2713 } | 2713 } |
| 2714 | 2714 |
| 2715 // Tests that username/password are autofilled when JavaScript is changing url |
| 2716 // between discovering a form and receving credentials from the browser process. |
| 2717 TEST_F(PasswordAutofillAgentTest, AutocompleteWhenPageUrlIsChanged) { |
| 2718 // Simulate that JavaScript changes url. |
| 2719 fill_data_.origin = GURL(fill_data_.origin.possibly_invalid_spec() + "/path"); |
| 2720 |
| 2721 SimulateOnFillPasswordForm(fill_data_); |
| 2722 |
| 2723 // The username and password should have been autocompleted. |
| 2724 CheckTextFieldsState(kAliceUsername, true, kAlicePassword, true); |
| 2725 } |
| 2715 } // namespace autofill | 2726 } // namespace autofill |
| OLD | NEW |