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 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 // Change focus in between to make sure blur events don't trigger filling. | 841 // Change focus in between to make sure blur events don't trigger filling. |
842 SetFocused(password_element_); | 842 SetFocused(password_element_); |
843 SetFocused(username_element_); | 843 SetFocused(username_element_); |
844 // No autocomplete should happen when text is entered in the username. | 844 // No autocomplete should happen when text is entered in the username. |
845 CheckTextFieldsState(kAliceUsername, false, std::string(), false); | 845 CheckTextFieldsState(kAliceUsername, false, std::string(), false); |
846 } | 846 } |
847 | 847 |
848 TEST_F(PasswordAutofillAgentTest, IsWebElementVisibleTest) { | 848 TEST_F(PasswordAutofillAgentTest, IsWebElementVisibleTest) { |
849 blink::WebVector<WebFormElement> forms1, forms2, forms3; | 849 blink::WebVector<WebFormElement> forms1, forms2, forms3; |
850 blink::WebVector<blink::WebFormControlElement> web_control_elements; | 850 blink::WebVector<blink::WebFormControlElement> web_control_elements; |
851 blink::WebFrame* frame; | 851 blink::WebLocalFrame* frame; |
852 | 852 |
853 LoadHTML(kVisibleFormWithNoUsernameHTML); | 853 LoadHTML(kVisibleFormWithNoUsernameHTML); |
854 frame = GetMainFrame(); | 854 frame = GetMainFrame(); |
855 frame->GetDocument().Forms(forms1); | 855 frame->GetDocument().Forms(forms1); |
856 ASSERT_EQ(1u, forms1.size()); | 856 ASSERT_EQ(1u, forms1.size()); |
857 forms1[0].GetFormControlElements(web_control_elements); | 857 forms1[0].GetFormControlElements(web_control_elements); |
858 ASSERT_EQ(1u, web_control_elements.size()); | 858 ASSERT_EQ(1u, web_control_elements.size()); |
859 EXPECT_TRUE(form_util::IsWebElementVisible(web_control_elements[0])); | 859 EXPECT_TRUE(form_util::IsWebElementVisible(web_control_elements[0])); |
860 | 860 |
861 LoadHTML(kNonVisibleFormHTML); | 861 LoadHTML(kNonVisibleFormHTML); |
(...skipping 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2975 // Repeatedly occurring AJAX events without removing the input elements | 2975 // Repeatedly occurring AJAX events without removing the input elements |
2976 // shouldn't be treated as a password submission. | 2976 // shouldn't be treated as a password submission. |
2977 password_autofill_agent_->AJAXSucceeded(); | 2977 password_autofill_agent_->AJAXSucceeded(); |
2978 base::RunLoop().RunUntilIdle(); | 2978 base::RunLoop().RunUntilIdle(); |
2979 | 2979 |
2980 ASSERT_FALSE(fake_driver_.called_password_form_submitted()); | 2980 ASSERT_FALSE(fake_driver_.called_password_form_submitted()); |
2981 ASSERT_FALSE(static_cast<bool>(fake_driver_.password_form_submitted())); | 2981 ASSERT_FALSE(static_cast<bool>(fake_driver_.password_form_submitted())); |
2982 } | 2982 } |
2983 | 2983 |
2984 } // namespace autofill | 2984 } // namespace autofill |
OLD | NEW |