| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // renderer. | 134 // renderer. |
| 135 void VerifyNoSubmitMessagesReceived( | 135 void VerifyNoSubmitMessagesReceived( |
| 136 const FakeContentAutofillDriver& fake_driver) { | 136 const FakeContentAutofillDriver& fake_driver) { |
| 137 // No submission messages sent. | 137 // No submission messages sent. |
| 138 EXPECT_EQ(nullptr, fake_driver.form_will_submit()); | 138 EXPECT_EQ(nullptr, fake_driver.form_will_submit()); |
| 139 EXPECT_EQ(nullptr, fake_driver.form_submitted()); | 139 EXPECT_EQ(nullptr, fake_driver.form_submitted()); |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Simulates receiving a message from the browser to fill a form. | 142 // Simulates receiving a message from the browser to fill a form. |
| 143 void SimulateOnFillForm(autofill::AutofillAgent* autofill_agent, | 143 void SimulateOnFillForm(autofill::AutofillAgent* autofill_agent, |
| 144 blink::WebFrame* main_frame) { | 144 blink::WebLocalFrame* main_frame) { |
| 145 WebDocument document = main_frame->GetDocument(); | 145 WebDocument document = main_frame->GetDocument(); |
| 146 WebElement element = document.GetElementById(WebString::FromUTF8("fname")); | 146 WebElement element = document.GetElementById(WebString::FromUTF8("fname")); |
| 147 ASSERT_FALSE(element.IsNull()); | 147 ASSERT_FALSE(element.IsNull()); |
| 148 | 148 |
| 149 // This call is necessary to setup the autofill agent appropriate for the | 149 // This call is necessary to setup the autofill agent appropriate for the |
| 150 // user selection; simulates the menu actually popping up. | 150 // user selection; simulates the menu actually popping up. |
| 151 static_cast<autofill::PageClickListener*>(autofill_agent) | 151 static_cast<autofill::PageClickListener*>(autofill_agent) |
| 152 ->FormControlElementClicked(element.To<WebInputElement>(), false); | 152 ->FormControlElementClicked(element.To<WebInputElement>(), false); |
| 153 | 153 |
| 154 FormData data; | 154 FormData data; |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 | 649 |
| 650 // Submit the form. | 650 // Submit the form. |
| 651 ExecuteJavaScriptForTests("document.getElementById('myForm').submit();"); | 651 ExecuteJavaScriptForTests("document.getElementById('myForm').submit();"); |
| 652 base::RunLoop().RunUntilIdle(); | 652 base::RunLoop().RunUntilIdle(); |
| 653 | 653 |
| 654 VerifyReceivedRendererMessages(fake_driver_, "Rick", "Deckard", | 654 VerifyReceivedRendererMessages(fake_driver_, "Rick", "Deckard", |
| 655 true /* expect_submitted_message */); | 655 true /* expect_submitted_message */); |
| 656 } | 656 } |
| 657 | 657 |
| 658 } // namespace autofill | 658 } // namespace autofill |
| OLD | NEW |