Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: content/browser/renderer_host/render_view_host_unittest.cc

Issue 9838009: Clean up a few TODO items. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/browser/child_process_security_policy_impl.h" 5 #include "content/browser/child_process_security_policy_impl.h"
6 #include "content/browser/renderer_host/test_render_view_host.h" 6 #include "content/browser/renderer_host/test_render_view_host.h"
7 #include "content/browser/tab_contents/navigation_controller_impl.h" 7 #include "content/browser/tab_contents/navigation_controller_impl.h"
8 #include "content/browser/tab_contents/test_tab_contents.h" 8 #include "content/browser/tab_contents/test_tab_contents.h"
9 #include "content/common/view_messages.h" 9 #include "content/common/view_messages.h"
10 #include "content/public/browser/navigation_entry.h" 10 #include "content/public/browser/navigation_entry.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) 174 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
175 175
176 // Test that when we fail to de-serialize a message, RenderViewHost calls the 176 // Test that when we fail to de-serialize a message, RenderViewHost calls the
177 // ReceivedBadMessage() handler. 177 // ReceivedBadMessage() handler.
178 TEST_F(RenderViewHostTest, BadMessageHandlerRenderViewHost) { 178 TEST_F(RenderViewHostTest, BadMessageHandlerRenderViewHost) {
179 EXPECT_EQ(0, process()->bad_msg_count()); 179 EXPECT_EQ(0, process()->bad_msg_count());
180 // craft an incorrect ViewHostMsg_UpdateTargetURL message. The real one has 180 // craft an incorrect ViewHostMsg_UpdateTargetURL message. The real one has
181 // two payload items but the one we construct has none. 181 // two payload items but the one we construct has none.
182 IPC::Message message(0, ViewHostMsg_UpdateTargetURL::ID, 182 IPC::Message message(0, ViewHostMsg_UpdateTargetURL::ID,
183 IPC::Message::PRIORITY_NORMAL); 183 IPC::Message::PRIORITY_NORMAL);
184 test_rvh()->TestOnMessageReceived(message); 184 test_rvh()->OnMessageReceived(message);
185 EXPECT_EQ(1, process()->bad_msg_count()); 185 EXPECT_EQ(1, process()->bad_msg_count());
186 } 186 }
187 187
188 // Test that when we fail to de-serialize a message, RenderWidgetHost calls the 188 // Test that when we fail to de-serialize a message, RenderWidgetHost calls the
189 // ReceivedBadMessage() handler. 189 // ReceivedBadMessage() handler.
190 TEST_F(RenderViewHostTest, BadMessageHandlerRenderWidgetHost) { 190 TEST_F(RenderViewHostTest, BadMessageHandlerRenderWidgetHost) {
191 EXPECT_EQ(0, process()->bad_msg_count()); 191 EXPECT_EQ(0, process()->bad_msg_count());
192 // craft an incorrect ViewHostMsg_UpdateRect message. The real one has 192 // craft an incorrect ViewHostMsg_UpdateRect message. The real one has
193 // one payload item but the one we construct has none. 193 // one payload item but the one we construct has none.
194 IPC::Message message(0, ViewHostMsg_UpdateRect::ID, 194 IPC::Message message(0, ViewHostMsg_UpdateRect::ID,
195 IPC::Message::PRIORITY_NORMAL); 195 IPC::Message::PRIORITY_NORMAL);
196 test_rvh()->TestOnMessageReceived(message); 196 test_rvh()->OnMessageReceived(message);
197 EXPECT_EQ(1, process()->bad_msg_count()); 197 EXPECT_EQ(1, process()->bad_msg_count());
198 } 198 }
199 199
200 // Test that OnMsgInputEventAck() detects bad messages. 200 // Test that OnMsgInputEventAck() detects bad messages.
201 TEST_F(RenderViewHostTest, BadMessageHandlerInputEventAck) { 201 TEST_F(RenderViewHostTest, BadMessageHandlerInputEventAck) {
202 EXPECT_EQ(0, process()->bad_msg_count()); 202 EXPECT_EQ(0, process()->bad_msg_count());
203 // ViewHostMsg_HandleInputEvent_ACK is defined taking 0 params but 203 // ViewHostMsg_HandleInputEvent_ACK is defined taking 0 params but
204 // the code actually expects it to have at least one int para, this this 204 // the code actually expects it to have at least one int para, this this
205 // bogus message will not fail at de-serialization but should fail in 205 // bogus message will not fail at de-serialization but should fail in
206 // OnMsgInputEventAck() processing. 206 // OnMsgInputEventAck() processing.
207 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, 207 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID,
208 IPC::Message::PRIORITY_NORMAL); 208 IPC::Message::PRIORITY_NORMAL);
209 test_rvh()->TestOnMessageReceived(message); 209 test_rvh()->OnMessageReceived(message);
210 EXPECT_EQ(1, process()->bad_msg_count()); 210 EXPECT_EQ(1, process()->bad_msg_count());
211 } 211 }
212 212
213 #endif 213 #endif
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698