OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <tuple> | 5 #include <tuple> |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // renderer. | 129 // renderer. |
130 void VerifyNoSubmitMessagesReceived( | 130 void VerifyNoSubmitMessagesReceived( |
131 const FakeContentAutofillDriver& fake_driver) { | 131 const FakeContentAutofillDriver& fake_driver) { |
132 // No submission messages sent. | 132 // No submission messages sent. |
133 EXPECT_EQ(nullptr, fake_driver.form_will_submit()); | 133 EXPECT_EQ(nullptr, fake_driver.form_will_submit()); |
134 EXPECT_EQ(nullptr, fake_driver.form_submitted()); | 134 EXPECT_EQ(nullptr, fake_driver.form_submitted()); |
135 } | 135 } |
136 | 136 |
137 // Simulates receiving a message from the browser to fill a form. | 137 // Simulates receiving a message from the browser to fill a form. |
138 void SimulateOnFillForm(autofill::AutofillAgent* autofill_agent, | 138 void SimulateOnFillForm(autofill::AutofillAgent* autofill_agent, |
139 blink::WebFrame* main_frame) { | 139 blink::WebLocalFrame* main_frame) { |
140 WebDocument document = main_frame->GetDocument(); | 140 WebDocument document = main_frame->GetDocument(); |
141 WebElement element = document.GetElementById(WebString::FromUTF8("fname")); | 141 WebElement element = document.GetElementById(WebString::FromUTF8("fname")); |
142 ASSERT_FALSE(element.IsNull()); | 142 ASSERT_FALSE(element.IsNull()); |
143 | 143 |
144 // This call is necessary to setup the autofill agent appropriate for the | 144 // This call is necessary to setup the autofill agent appropriate for the |
145 // user selection; simulates the menu actually popping up. | 145 // user selection; simulates the menu actually popping up. |
146 static_cast<autofill::PageClickListener*>(autofill_agent) | 146 static_cast<autofill::PageClickListener*>(autofill_agent) |
147 ->FormControlElementClicked(element.To<WebInputElement>(), false); | 147 ->FormControlElementClicked(element.To<WebInputElement>(), false); |
148 | 148 |
149 FormData data; | 149 FormData data; |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 | 644 |
645 // Submit the form. | 645 // Submit the form. |
646 ExecuteJavaScriptForTests("document.getElementById('myForm').submit();"); | 646 ExecuteJavaScriptForTests("document.getElementById('myForm').submit();"); |
647 base::RunLoop().RunUntilIdle(); | 647 base::RunLoop().RunUntilIdle(); |
648 | 648 |
649 VerifyReceivedRendererMessages(fake_driver_, "Rick", "Deckard", | 649 VerifyReceivedRendererMessages(fake_driver_, "Rick", "Deckard", |
650 true /* expect_submitted_message */); | 650 true /* expect_submitted_message */); |
651 } | 651 } |
652 | 652 |
653 } // namespace autofill | 653 } // namespace autofill |
OLD | NEW |