| 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 "content/browser/child_process_security_policy_impl.h" | 6 #include "content/browser/child_process_security_policy_impl.h" |
| 7 #include "content/browser/renderer_host/test_render_view_host.h" | 7 #include "content/browser/renderer_host/test_render_view_host.h" |
| 8 #include "content/browser/web_contents/navigation_controller_impl.h" | 8 #include "content/browser/web_contents/navigation_controller_impl.h" |
| 9 #include "content/common/view_input_messages.h" |
| 9 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| 10 #include "content/port/browser/render_view_host_delegate_view.h" | 11 #include "content/port/browser/render_view_host_delegate_view.h" |
| 11 #include "content/public/browser/navigation_entry.h" | 12 #include "content/public/browser/navigation_entry.h" |
| 12 #include "content/public/common/bindings_policy.h" | 13 #include "content/public/common/bindings_policy.h" |
| 13 #include "content/public/common/page_transition_types.h" | 14 #include "content/public/common/page_transition_types.h" |
| 14 #include "content/public/test/mock_render_process_host.h" | 15 #include "content/public/test/mock_render_process_host.h" |
| 15 #include "content/test/test_web_contents.h" | 16 #include "content/test/test_web_contents.h" |
| 16 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" |
| 18 #include "webkit/glue/webdropdata.h" | 19 #include "webkit/glue/webdropdata.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // one payload item but the one we construct has none. | 208 // one payload item but the one we construct has none. |
| 208 IPC::Message message(0, ViewHostMsg_UpdateRect::ID, | 209 IPC::Message message(0, ViewHostMsg_UpdateRect::ID, |
| 209 IPC::Message::PRIORITY_NORMAL); | 210 IPC::Message::PRIORITY_NORMAL); |
| 210 test_rvh()->OnMessageReceived(message); | 211 test_rvh()->OnMessageReceived(message); |
| 211 EXPECT_EQ(1, process()->bad_msg_count()); | 212 EXPECT_EQ(1, process()->bad_msg_count()); |
| 212 } | 213 } |
| 213 | 214 |
| 214 // Test that OnInputEventAck() detects bad messages. | 215 // Test that OnInputEventAck() detects bad messages. |
| 215 TEST_F(RenderViewHostTest, BadMessageHandlerInputEventAck) { | 216 TEST_F(RenderViewHostTest, BadMessageHandlerInputEventAck) { |
| 216 EXPECT_EQ(0, process()->bad_msg_count()); | 217 EXPECT_EQ(0, process()->bad_msg_count()); |
| 217 // ViewHostMsg_HandleInputEvent_ACK is defined taking 0 params but | 218 // ViewInputHostMsg_HandleInputEvent_ACK is defined taking 0 params but |
| 218 // the code actually expects it to have at least one int para, this this | 219 // the code actually expects it to have at least one int para, this this |
| 219 // bogus message will not fail at de-serialization but should fail in | 220 // bogus message will not fail at de-serialization but should fail in |
| 220 // OnInputEventAck() processing. | 221 // OnInputEventAck() processing. |
| 221 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, | 222 IPC::Message message(0, ViewInputHostMsg_HandleInputEvent_ACK::ID, |
| 222 IPC::Message::PRIORITY_NORMAL); | 223 IPC::Message::PRIORITY_NORMAL); |
| 223 test_rvh()->OnMessageReceived(message); | 224 test_rvh()->OnMessageReceived(message); |
| 224 EXPECT_EQ(1, process()->bad_msg_count()); | 225 EXPECT_EQ(1, process()->bad_msg_count()); |
| 225 } | 226 } |
| 226 | 227 |
| 227 #endif | 228 #endif |
| 228 | 229 |
| 229 } // namespace content | 230 } // namespace content |
| OLD | NEW |