| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/common/autofill_messages.h" | 11 #include "chrome/common/autofill_messages.h" |
| 12 #include "chrome/common/content_settings.h" | 12 #include "chrome/common/content_settings.h" |
| 13 #include "chrome/common/native_web_keyboard_event.h" | 13 #include "chrome/common/native_web_keyboard_event.h" |
| 14 #include "chrome/common/render_messages.h" | 14 #include "chrome/common/render_messages.h" |
| 15 #include "chrome/common/render_messages_params.h" | 15 #include "chrome/common/render_messages_params.h" |
| 16 #include "chrome/renderer/autofill_helper.h" | 16 #include "chrome/renderer/autofill/autofill_agent.h" |
| 17 #include "chrome/renderer/print_web_view_helper.h" | 17 #include "chrome/renderer/print_web_view_helper.h" |
| 18 #include "chrome/test/render_view_test.h" | 18 #include "chrome/test/render_view_test.h" |
| 19 #include "gfx/codec/jpeg_codec.h" | 19 #include "gfx/codec/jpeg_codec.h" |
| 20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 21 #include "printing/image.h" | 21 #include "printing/image.h" |
| 22 #include "printing/native_metafile.h" | 22 #include "printing/native_metafile.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
| 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 // Verify that |didAcceptAutoFillSuggestion()| sends the expected number of | 1060 // Verify that |didAcceptAutoFillSuggestion()| sends the expected number of |
| 1061 // fields. | 1061 // fields. |
| 1062 WebFrame* web_frame = GetMainFrame(); | 1062 WebFrame* web_frame = GetMainFrame(); |
| 1063 WebDocument document = web_frame->document(); | 1063 WebDocument document = web_frame->document(); |
| 1064 WebInputElement firstname = | 1064 WebInputElement firstname = |
| 1065 document.getElementById("firstname").to<WebInputElement>(); | 1065 document.getElementById("firstname").to<WebInputElement>(); |
| 1066 | 1066 |
| 1067 // Accept suggestion that contains a label. Labeled items indicate AutoFill | 1067 // Accept suggestion that contains a label. Labeled items indicate AutoFill |
| 1068 // as opposed to Autocomplete. We're testing this distinction below with | 1068 // as opposed to Autocomplete. We're testing this distinction below with |
| 1069 // the |AutoFillHostMsg_FillAutoFillFormData::ID| message. | 1069 // the |AutoFillHostMsg_FillAutoFillFormData::ID| message. |
| 1070 autofill_helper_->didAcceptAutoFillSuggestion( | 1070 autofill_agent_->didAcceptAutoFillSuggestion( |
| 1071 firstname, | 1071 firstname, |
| 1072 WebKit::WebString::fromUTF8("Johnny"), | 1072 WebKit::WebString::fromUTF8("Johnny"), |
| 1073 WebKit::WebString::fromUTF8("Home"), | 1073 WebKit::WebString::fromUTF8("Home"), |
| 1074 1, | 1074 1, |
| 1075 -1); | 1075 -1); |
| 1076 | 1076 |
| 1077 ProcessPendingMessages(); | 1077 ProcessPendingMessages(); |
| 1078 const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching( | 1078 const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching( |
| 1079 AutoFillHostMsg_FillAutoFillFormData::ID); | 1079 AutoFillHostMsg_FillAutoFillFormData::ID); |
| 1080 ASSERT_NE(static_cast<IPC::Message*>(NULL), message2); | 1080 ASSERT_NE(static_cast<IPC::Message*>(NULL), message2); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 WebFrame* web_frame = GetMainFrame(); | 1146 WebFrame* web_frame = GetMainFrame(); |
| 1147 WebDocument document = web_frame->document(); | 1147 WebDocument document = web_frame->document(); |
| 1148 WebInputElement firstname = | 1148 WebInputElement firstname = |
| 1149 document.getElementById("firstname").to<WebInputElement>(); | 1149 document.getElementById("firstname").to<WebInputElement>(); |
| 1150 WebInputElement middlename = | 1150 WebInputElement middlename = |
| 1151 document.getElementById("middlename").to<WebInputElement>(); | 1151 document.getElementById("middlename").to<WebInputElement>(); |
| 1152 middlename.setAutofilled(true); | 1152 middlename.setAutofilled(true); |
| 1153 | 1153 |
| 1154 // Accept a suggestion in a form that has been auto-filled. This triggers | 1154 // Accept a suggestion in a form that has been auto-filled. This triggers |
| 1155 // the direct filling of the firstname element with value parameter. | 1155 // the direct filling of the firstname element with value parameter. |
| 1156 autofill_helper_->didAcceptAutoFillSuggestion( | 1156 autofill_agent_->didAcceptAutoFillSuggestion( |
| 1157 firstname, | 1157 firstname, |
| 1158 WebKit::WebString::fromUTF8("David"), | 1158 WebKit::WebString::fromUTF8("David"), |
| 1159 WebKit::WebString(), | 1159 WebKit::WebString(), |
| 1160 0, | 1160 0, |
| 1161 0); | 1161 0); |
| 1162 | 1162 |
| 1163 ProcessPendingMessages(); | 1163 ProcessPendingMessages(); |
| 1164 const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching( | 1164 const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching( |
| 1165 AutoFillHostMsg_FillAutoFillFormData::ID); | 1165 AutoFillHostMsg_FillAutoFillFormData::ID); |
| 1166 | 1166 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 LoadHTML("<html><head><meta http-equiv=\"content-language\" " | 1230 LoadHTML("<html><head><meta http-equiv=\"content-language\" " |
| 1231 "content=\" fr , es,en \">" | 1231 "content=\" fr , es,en \">" |
| 1232 "</head><body>A random page with random content.</body></html>"); | 1232 "</head><body>A random page with random content.</body></html>"); |
| 1233 ProcessPendingMessages(); | 1233 ProcessPendingMessages(); |
| 1234 message = render_thread_.sink().GetUniqueMessageMatching( | 1234 message = render_thread_.sink().GetUniqueMessageMatching( |
| 1235 ViewHostMsg_PageContents::ID); | 1235 ViewHostMsg_PageContents::ID); |
| 1236 ASSERT_NE(static_cast<IPC::Message*>(NULL), message); | 1236 ASSERT_NE(static_cast<IPC::Message*>(NULL), message); |
| 1237 ViewHostMsg_PageContents::Read(message, ¶ms); | 1237 ViewHostMsg_PageContents::Read(message, ¶ms); |
| 1238 EXPECT_EQ("fr", params.d); | 1238 EXPECT_EQ("fr", params.d); |
| 1239 } | 1239 } |
| OLD | NEW |