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

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

Issue 35643005: Remove unused IPC::Message priority. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 1 month 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 "base/path_service.h" 5 #include "base/path_service.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/browser/child_process_security_policy_impl.h" 7 #include "content/browser/child_process_security_policy_impl.h"
8 #include "content/browser/renderer_host/test_render_view_host.h" 8 #include "content/browser/renderer_host/test_render_view_host.h"
9 #include "content/browser/web_contents/navigation_controller_impl.h" 9 #include "content/browser/web_contents/navigation_controller_impl.h"
10 #include "content/common/input_messages.h" 10 #include "content/common/input_messages.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 // The test that follow trigger DCHECKS in debug build. 220 // The test that follow trigger DCHECKS in debug build.
221 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) 221 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
222 222
223 // Test that when we fail to de-serialize a message, RenderViewHost calls the 223 // Test that when we fail to de-serialize a message, RenderViewHost calls the
224 // ReceivedBadMessage() handler. 224 // ReceivedBadMessage() handler.
225 TEST_F(RenderViewHostTest, BadMessageHandlerRenderViewHost) { 225 TEST_F(RenderViewHostTest, BadMessageHandlerRenderViewHost) {
226 EXPECT_EQ(0, process()->bad_msg_count()); 226 EXPECT_EQ(0, process()->bad_msg_count());
227 // craft an incorrect ViewHostMsg_UpdateTargetURL message. The real one has 227 // craft an incorrect ViewHostMsg_UpdateTargetURL message. The real one has
228 // two payload items but the one we construct has none. 228 // two payload items but the one we construct has none.
229 IPC::Message message(0, ViewHostMsg_UpdateTargetURL::ID, 229 IPC::Message message(0, ViewHostMsg_UpdateTargetURL::ID);
230 IPC::Message::PRIORITY_NORMAL);
231 test_rvh()->OnMessageReceived(message); 230 test_rvh()->OnMessageReceived(message);
232 EXPECT_EQ(1, process()->bad_msg_count()); 231 EXPECT_EQ(1, process()->bad_msg_count());
233 } 232 }
234 233
235 // Test that when we fail to de-serialize a message, RenderWidgetHost calls the 234 // Test that when we fail to de-serialize a message, RenderWidgetHost calls the
236 // ReceivedBadMessage() handler. 235 // ReceivedBadMessage() handler.
237 TEST_F(RenderViewHostTest, BadMessageHandlerRenderWidgetHost) { 236 TEST_F(RenderViewHostTest, BadMessageHandlerRenderWidgetHost) {
238 EXPECT_EQ(0, process()->bad_msg_count()); 237 EXPECT_EQ(0, process()->bad_msg_count());
239 // craft an incorrect ViewHostMsg_UpdateRect message. The real one has 238 // craft an incorrect ViewHostMsg_UpdateRect message. The real one has
240 // one payload item but the one we construct has none. 239 // one payload item but the one we construct has none.
241 IPC::Message message(0, ViewHostMsg_UpdateRect::ID, 240 IPC::Message message(0, ViewHostMsg_UpdateRect::ID);
242 IPC::Message::PRIORITY_NORMAL);
243 test_rvh()->OnMessageReceived(message); 241 test_rvh()->OnMessageReceived(message);
244 EXPECT_EQ(1, process()->bad_msg_count()); 242 EXPECT_EQ(1, process()->bad_msg_count());
245 } 243 }
246 244
247 // Test that OnInputEventAck() detects bad messages. 245 // Test that OnInputEventAck() detects bad messages.
248 TEST_F(RenderViewHostTest, BadMessageHandlerInputEventAck) { 246 TEST_F(RenderViewHostTest, BadMessageHandlerInputEventAck) {
249 EXPECT_EQ(0, process()->bad_msg_count()); 247 EXPECT_EQ(0, process()->bad_msg_count());
250 // InputHostMsg_HandleInputEvent_ACK is defined taking 0 params but 248 // InputHostMsg_HandleInputEvent_ACK is defined taking 0 params but
251 // the code actually expects it to have at least one int para, this this 249 // the code actually expects it to have at least one int para, this this
252 // bogus message will not fail at de-serialization but should fail in 250 // bogus message will not fail at de-serialization but should fail in
253 // OnInputEventAck() processing. 251 // OnInputEventAck() processing.
254 IPC::Message message(0, InputHostMsg_HandleInputEvent_ACK::ID, 252 IPC::Message message(0, InputHostMsg_HandleInputEvent_ACK::ID);
255 IPC::Message::PRIORITY_NORMAL);
256 test_rvh()->OnMessageReceived(message); 253 test_rvh()->OnMessageReceived(message);
257 EXPECT_EQ(1, process()->bad_msg_count()); 254 EXPECT_EQ(1, process()->bad_msg_count());
258 } 255 }
259 256
260 #endif 257 #endif
261 258
262 TEST_F(RenderViewHostTest, MessageWithBadHistoryItemFiles) { 259 TEST_F(RenderViewHostTest, MessageWithBadHistoryItemFiles) {
263 base::FilePath file_path; 260 base::FilePath file_path;
264 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file_path)); 261 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file_path));
265 file_path = file_path.AppendASCII("foo"); 262 file_path = file_path.AppendASCII("foo");
(...skipping 23 matching lines...) Expand all
289 } 286 }
290 287
291 TEST_F(RenderViewHostTest, RoutingIdSane) { 288 TEST_F(RenderViewHostTest, RoutingIdSane) {
292 EXPECT_EQ(test_rvh()->GetProcess(), 289 EXPECT_EQ(test_rvh()->GetProcess(),
293 test_rvh()->main_render_frame_host()->GetProcess()); 290 test_rvh()->main_render_frame_host()->GetProcess());
294 EXPECT_NE(test_rvh()->GetRoutingID(), 291 EXPECT_NE(test_rvh()->GetRoutingID(),
295 test_rvh()->main_render_frame_host()->routing_id()); 292 test_rvh()->main_render_frame_host()->routing_id());
296 } 293 }
297 294
298 } // namespace content 295 } // namespace content
OLDNEW
« no previous file with comments | « components/nacl/loader/nacl_ipc_adapter_unittest.cc ('k') | content/common/cc_messages_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698