| 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 "base/time.h" | 5 #include "base/time.h" |
| 6 #include "chrome/common/autofill_messages.h" | 6 #include "chrome/common/autofill_messages.h" |
| 7 #include "chrome/test/base/chrome_render_view_test.h" | 7 #include "chrome/test/base/chrome_render_view_test.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.
h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.
h" |
| 13 #include "webkit/forms/form_data.h" | 13 #include "webkit/forms/form_data.h" |
| 14 #include "webkit/glue/web_io_operators.h" | 14 #include "webkit/glue/web_io_operators.h" |
| 15 | 15 |
| 16 using webkit::forms::FormData; | 16 using webkit::forms::FormData; |
| 17 using WebKit::WebFrame; | 17 using WebKit::WebFrame; |
| 18 using WebKit::WebString; | 18 using WebKit::WebString; |
| 19 using WebKit::WebTextDirection; | |
| 20 using WebKit::WebURLError; | 19 using WebKit::WebURLError; |
| 21 | 20 |
| 22 typedef ChromeRenderViewTest FormAutocompleteTest; | 21 typedef ChromeRenderViewTest FormAutocompleteTest; |
| 23 | 22 |
| 24 // Tests that submitting a form generates a FormSubmitted message | 23 // Tests that submitting a form generates a FormSubmitted message |
| 25 // with the form fields. | 24 // with the form fields. |
| 26 TEST_F(FormAutocompleteTest, NormalFormSubmit) { | 25 TEST_F(FormAutocompleteTest, NormalFormSubmit) { |
| 27 // Load a form. | 26 // Load a form. |
| 28 LoadHTML("<html><form id='myForm'><input name='fname' value='Rick'/>" | 27 LoadHTML("<html><form id='myForm'><input name='fname' value='Rick'/>" |
| 29 "<input name='lname' value='Deckard'/></form></html>"); | 28 "<input name='lname' value='Deckard'/></form></html>"); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 EXPECT_FALSE(form.autoComplete()); | 114 EXPECT_FALSE(form.autoComplete()); |
| 116 | 115 |
| 117 // Submit the form. | 116 // Submit the form. |
| 118 ExecuteJavaScript("document.getElementById('myForm').submit();"); | 117 ExecuteJavaScript("document.getElementById('myForm').submit();"); |
| 119 ProcessPendingMessages(); | 118 ProcessPendingMessages(); |
| 120 | 119 |
| 121 // No FormSubmitted message should have been sent. | 120 // No FormSubmitted message should have been sent. |
| 122 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( | 121 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( |
| 123 AutofillHostMsg_FormSubmitted::ID)); | 122 AutofillHostMsg_FormSubmitted::ID)); |
| 124 } | 123 } |
| OLD | NEW |