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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin_browsertest.cc

Issue 283623002: Add support for passing an arbitrary parameter to an IPC message handler. The motivation is for Web… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 6 years, 7 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/renderer/browser_plugin/browser_plugin_browsertest.h" 5 #include "content/renderer/browser_plugin/browser_plugin_browsertest.h"
6 6
7 #include "base/debug/leak_annotations.h" 7 #include "base/debug/leak_annotations.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 const IPC::Message* create_msg = 262 const IPC::Message* create_msg =
263 browser_plugin_manager()->sink().GetUniqueMessageMatching( 263 browser_plugin_manager()->sink().GetUniqueMessageMatching(
264 BrowserPluginHostMsg_Attach::ID); 264 BrowserPluginHostMsg_Attach::ID);
265 ASSERT_FALSE(create_msg); 265 ASSERT_FALSE(create_msg);
266 266
267 const IPC::Message* msg = 267 const IPC::Message* msg =
268 browser_plugin_manager()->sink().GetUniqueMessageMatching( 268 browser_plugin_manager()->sink().GetUniqueMessageMatching(
269 BrowserPluginHostMsg_NavigateGuest::ID); 269 BrowserPluginHostMsg_NavigateGuest::ID);
270 ASSERT_TRUE(msg); 270 ASSERT_TRUE(msg);
271 271
272 int instance_id = 0; 272 BrowserPluginHostMsg_NavigateGuest::Param params;
273 std::string src; 273 BrowserPluginHostMsg_NavigateGuest::Read(msg, &params);
274 BrowserPluginHostMsg_NavigateGuest::Read(msg, &instance_id, &src); 274 std::string src = params.b;
275 EXPECT_EQ("bar", src); 275 EXPECT_EQ("bar", src);
276 std::string src_value = 276 std::string src_value =
277 ExecuteScriptAndReturnString( 277 ExecuteScriptAndReturnString(
278 "document.getElementById('browserplugin').src"); 278 "document.getElementById('browserplugin').src");
279 EXPECT_EQ("bar", src_value); 279 EXPECT_EQ("bar", src_value);
280 } 280 }
281 } 281 }
282 282
283 TEST_F(BrowserPluginTest, ResizeFlowControl) { 283 TEST_F(BrowserPluginTest, ResizeFlowControl) {
284 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); 284 LoadHTML(GetHTMLForBrowserPluginObject().c_str());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 for (size_t i = 0; i < browser_plugin_manager()->sink().message_count(); 321 for (size_t i = 0; i < browser_plugin_manager()->sink().message_count();
322 ++i) { 322 ++i) {
323 const IPC::Message* msg = browser_plugin_manager()->sink().GetMessageAt(i); 323 const IPC::Message* msg = browser_plugin_manager()->sink().GetMessageAt(i);
324 if (msg->type() != BrowserPluginHostMsg_ResizeGuest::ID) 324 if (msg->type() != BrowserPluginHostMsg_ResizeGuest::ID)
325 EXPECT_EQ(msg->type(), BrowserPluginHostMsg_UpdateGeometry::ID); 325 EXPECT_EQ(msg->type(), BrowserPluginHostMsg_UpdateGeometry::ID);
326 } 326 }
327 const IPC::Message* msg = 327 const IPC::Message* msg =
328 browser_plugin_manager()->sink().GetUniqueMessageMatching( 328 browser_plugin_manager()->sink().GetUniqueMessageMatching(
329 BrowserPluginHostMsg_ResizeGuest::ID); 329 BrowserPluginHostMsg_ResizeGuest::ID);
330 ASSERT_TRUE(msg); 330 ASSERT_TRUE(msg);
331 BrowserPluginHostMsg_ResizeGuest_Params params; 331 BrowserPluginHostMsg_ResizeGuest::Param param;
332 BrowserPluginHostMsg_ResizeGuest::Read(msg, &instance_id, &params); 332 BrowserPluginHostMsg_ResizeGuest::Read(msg, &param);
333 instance_id = param.a;
334 BrowserPluginHostMsg_ResizeGuest_Params params = param.b;
333 EXPECT_EQ(641, params.view_rect.width()); 335 EXPECT_EQ(641, params.view_rect.width());
334 EXPECT_EQ(480, params.view_rect.height()); 336 EXPECT_EQ(480, params.view_rect.height());
335 337
336 { 338 {
337 // We send a stale UpdateRect to the BrowserPlugin. 339 // We send a stale UpdateRect to the BrowserPlugin.
338 BrowserPluginMsg_UpdateRect_Params update_rect_params; 340 BrowserPluginMsg_UpdateRect_Params update_rect_params;
339 update_rect_params.view_size = gfx::Size(641, 480); 341 update_rect_params.view_size = gfx::Size(641, 480);
340 update_rect_params.scale_factor = 1.0f; 342 update_rect_params.scale_factor = 1.0f;
341 update_rect_params.is_resize_ack = true; 343 update_rect_params.is_resize_ack = true;
342 BrowserPluginMsg_UpdateRect msg(instance_id, update_rect_params); 344 BrowserPluginMsg_UpdateRect msg(instance_id, update_rect_params);
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 BrowserPluginMsg_UpdateRect msg(instance_id, update_rect_params); 571 BrowserPluginMsg_UpdateRect msg(instance_id, update_rect_params);
570 browser_plugin->OnMessageReceived(msg); 572 browser_plugin->OnMessageReceived(msg);
571 573
572 // Verify that the autosize state has been updated. 574 // Verify that the autosize state has been updated.
573 { 575 {
574 const IPC::Message* auto_size_msg = 576 const IPC::Message* auto_size_msg =
575 browser_plugin_manager()->sink().GetUniqueMessageMatching( 577 browser_plugin_manager()->sink().GetUniqueMessageMatching(
576 BrowserPluginHostMsg_SetAutoSize::ID); 578 BrowserPluginHostMsg_SetAutoSize::ID);
577 ASSERT_TRUE(auto_size_msg); 579 ASSERT_TRUE(auto_size_msg);
578 580
579 int instance_id = 0; 581 BrowserPluginHostMsg_SetAutoSize::Param param;
580 BrowserPluginHostMsg_AutoSize_Params auto_size_params; 582 BrowserPluginHostMsg_SetAutoSize::Read(auto_size_msg, &param);
581 BrowserPluginHostMsg_ResizeGuest_Params resize_params; 583 BrowserPluginHostMsg_AutoSize_Params auto_size_params = param.b;
582 BrowserPluginHostMsg_SetAutoSize::Read(auto_size_msg, 584 BrowserPluginHostMsg_ResizeGuest_Params resize_params = param.c;
583 &instance_id,
584 &auto_size_params,
585 &resize_params);
586 EXPECT_FALSE(auto_size_params.enable); 585 EXPECT_FALSE(auto_size_params.enable);
587 // These value are not populated (as an optimization) if autosize is 586 // These value are not populated (as an optimization) if autosize is
588 // disabled. 587 // disabled.
589 EXPECT_EQ(0, auto_size_params.min_size.width()); 588 EXPECT_EQ(0, auto_size_params.min_size.width());
590 EXPECT_EQ(0, auto_size_params.min_size.height()); 589 EXPECT_EQ(0, auto_size_params.min_size.height());
591 EXPECT_EQ(0, auto_size_params.max_size.width()); 590 EXPECT_EQ(0, auto_size_params.max_size.width());
592 EXPECT_EQ(0, auto_size_params.max_size.height()); 591 EXPECT_EQ(0, auto_size_params.max_size.height());
593 } 592 }
594 } 593 }
595 594
596 } // namespace content 595 } // namespace content
OLDNEW
« no previous file with comments | « content/common/view_messages.h ('k') | content/renderer/browser_plugin/browser_plugin_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698