| 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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "chrome/common/autofill_messages.h" | 6 #include "chrome/common/autofill_messages.h" |
| 7 #include "chrome/common/form_data.h" |
| 8 #include "chrome/common/form_field.h" |
| 7 #include "chrome/test/base/chrome_render_view_test.h" | 9 #include "chrome/test/base/chrome_render_view_test.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 12 #include "webkit/forms/form_data.h" | |
| 13 #include "webkit/forms/form_field.h" | |
| 14 | 14 |
| 15 using chrome::FormData; |
| 16 using chrome::FormField; |
| 15 using WebKit::WebDocument; | 17 using WebKit::WebDocument; |
| 16 using WebKit::WebFrame; | 18 using WebKit::WebFrame; |
| 17 using WebKit::WebInputElement; | 19 using WebKit::WebInputElement; |
| 18 using WebKit::WebString; | 20 using WebKit::WebString; |
| 19 using webkit::forms::FormData; | |
| 20 using webkit::forms::FormField; | |
| 21 | 21 |
| 22 namespace autofill { | 22 namespace autofill { |
| 23 | 23 |
| 24 TEST_F(ChromeRenderViewTest, SendForms) { | 24 TEST_F(ChromeRenderViewTest, SendForms) { |
| 25 // Don't want any delay for form state sync changes. This will still post a | 25 // Don't want any delay for form state sync changes. This will still post a |
| 26 // message so updates will get coalesced, but as soon as we spin the message | 26 // message so updates will get coalesced, but as soon as we spin the message |
| 27 // loop, it will generate an update. | 27 // loop, it will generate an update. |
| 28 SendContentStateImmediately(); | 28 SendContentStateImmediately(); |
| 29 | 29 |
| 30 LoadHTML("<form method=\"POST\">" | 30 LoadHTML("<form method=\"POST\">" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 const IPC::Message* message2 = | 167 const IPC::Message* message2 = |
| 168 render_thread_->sink().GetUniqueMessageMatching( | 168 render_thread_->sink().GetUniqueMessageMatching( |
| 169 AutofillHostMsg_FillAutofillFormData::ID); | 169 AutofillHostMsg_FillAutofillFormData::ID); |
| 170 | 170 |
| 171 // No message should be sent in this case. |firstname| is filled directly. | 171 // No message should be sent in this case. |firstname| is filled directly. |
| 172 ASSERT_EQ(static_cast<IPC::Message*>(NULL), message2); | 172 ASSERT_EQ(static_cast<IPC::Message*>(NULL), message2); |
| 173 EXPECT_EQ(firstname.value(), WebKit::WebString::fromUTF8("David")); | 173 EXPECT_EQ(firstname.value(), WebKit::WebString::fromUTF8("David")); |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace autofill | 176 } // namespace autofill |
| OLD | NEW |