Chromium Code Reviews| 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 "content/renderer/browser_plugin/browser_plugin_browsertest.h" | 5 #include "content/renderer/browser_plugin/browser_plugin_browsertest.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 BrowserPluginMsg_UpdateRect_Params update_rect_params; | 149 BrowserPluginMsg_UpdateRect_Params update_rect_params; |
| 150 update_rect_params.damage_buffer_identifier = | 150 update_rect_params.damage_buffer_identifier = |
| 151 #if defined(OS_MACOSX) | 151 #if defined(OS_MACOSX) |
| 152 browser_plugin->pending_damage_buffer_->id(); | 152 browser_plugin->pending_damage_buffer_->id(); |
| 153 #else | 153 #else |
| 154 browser_plugin->pending_damage_buffer_->handle(); | 154 browser_plugin->pending_damage_buffer_->handle(); |
| 155 #endif | 155 #endif |
| 156 update_rect_params.view_size = gfx::Size(640, 480); | 156 update_rect_params.view_size = gfx::Size(640, 480); |
| 157 update_rect_params.scale_factor = 1.0f; | 157 update_rect_params.scale_factor = 1.0f; |
| 158 update_rect_params.is_resize_ack = true; | 158 update_rect_params.is_resize_ack = true; |
| 159 browser_plugin->UpdateRect(0, update_rect_params); | 159 browser_plugin->ReceiveMessage( |
| 160 new BrowserPluginMsg_UpdateRect(0, instance_id, 0, update_rect_params)); | |
|
sadrul
2012/12/14 16:08:39
Are these messages leaking? Can you just create th
sadrul
2012/12/14 16:08:39
I see that the messages aren't leaking because the
Fady Samuel
2012/12/14 17:05:54
Done.
| |
| 160 EXPECT_FALSE(browser_plugin->pending_damage_buffer_); | 161 EXPECT_FALSE(browser_plugin->pending_damage_buffer_); |
| 161 } | 162 } |
| 162 | 163 |
| 163 // Verify that the src attribute on the browser plugin works as expected. | 164 // Verify that the src attribute on the browser plugin works as expected. |
| 164 TEST_F(BrowserPluginTest, SrcAttribute) { | 165 TEST_F(BrowserPluginTest, SrcAttribute) { |
| 165 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); | 166 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); |
| 166 // Verify that we're reporting the correct URL to navigate to based on the | 167 // Verify that we're reporting the correct URL to navigate to based on the |
| 167 // src attribute. | 168 // src attribute. |
| 168 { | 169 { |
| 169 // Ensure we get a CreateGuest on the initial navigation. | 170 // Ensure we get a CreateGuest on the initial navigation. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 update_rect_params.is_resize_ack = true; | 240 update_rect_params.is_resize_ack = true; |
| 240 // By sending the damage buffer handle back to BrowserPlugin on UpdateRect, | 241 // By sending the damage buffer handle back to BrowserPlugin on UpdateRect, |
| 241 // then the BrowserPlugin knows that the browser process has received and | 242 // then the BrowserPlugin knows that the browser process has received and |
| 242 // has begun to use the pending_damage_buffer. | 243 // has begun to use the pending_damage_buffer. |
| 243 update_rect_params.damage_buffer_identifier = | 244 update_rect_params.damage_buffer_identifier = |
| 244 #if defined(OS_MACOSX) | 245 #if defined(OS_MACOSX) |
| 245 browser_plugin->pending_damage_buffer_->id(); | 246 browser_plugin->pending_damage_buffer_->id(); |
| 246 #else | 247 #else |
| 247 browser_plugin->pending_damage_buffer_->handle(); | 248 browser_plugin->pending_damage_buffer_->handle(); |
| 248 #endif | 249 #endif |
| 249 browser_plugin->UpdateRect(0, update_rect_params); | 250 browser_plugin->ReceiveMessage( |
| 251 new BrowserPluginMsg_UpdateRect(0, instance_id, 0, update_rect_params)); | |
| 250 EXPECT_EQ(NULL, browser_plugin->pending_damage_buffer_); | 252 EXPECT_EQ(NULL, browser_plugin->pending_damage_buffer_); |
| 251 } | 253 } |
| 252 | 254 |
| 253 browser_plugin_manager()->sink().ClearMessages(); | 255 browser_plugin_manager()->sink().ClearMessages(); |
| 254 | 256 |
| 255 // Resize the browser plugin three times. | 257 // Resize the browser plugin three times. |
| 256 ExecuteJavaScript("document.getElementById('browserplugin').width = '641px'"); | 258 ExecuteJavaScript("document.getElementById('browserplugin').width = '641px'"); |
| 257 ProcessPendingMessages(); | 259 ProcessPendingMessages(); |
| 258 ExecuteJavaScript("document.getElementById('browserplugin').width = '642px'"); | 260 ExecuteJavaScript("document.getElementById('browserplugin').width = '642px'"); |
| 259 ProcessPendingMessages(); | 261 ProcessPendingMessages(); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 281 BrowserPluginMsg_UpdateRect_Params update_rect_params; | 283 BrowserPluginMsg_UpdateRect_Params update_rect_params; |
| 282 update_rect_params.view_size = gfx::Size(641, 480); | 284 update_rect_params.view_size = gfx::Size(641, 480); |
| 283 update_rect_params.scale_factor = 1.0f; | 285 update_rect_params.scale_factor = 1.0f; |
| 284 update_rect_params.is_resize_ack = true; | 286 update_rect_params.is_resize_ack = true; |
| 285 update_rect_params.damage_buffer_identifier = | 287 update_rect_params.damage_buffer_identifier = |
| 286 #if defined(OS_MACOSX) | 288 #if defined(OS_MACOSX) |
| 287 browser_plugin->pending_damage_buffer_->id(); | 289 browser_plugin->pending_damage_buffer_->id(); |
| 288 #else | 290 #else |
| 289 browser_plugin->pending_damage_buffer_->handle(); | 291 browser_plugin->pending_damage_buffer_->handle(); |
| 290 #endif | 292 #endif |
| 291 browser_plugin->UpdateRect(0, update_rect_params); | 293 browser_plugin->ReceiveMessage( |
| 294 new BrowserPluginMsg_UpdateRect(0, instance_id, 0, update_rect_params)); | |
| 292 // This tells us that the BrowserPlugin is still expecting another | 295 // This tells us that the BrowserPlugin is still expecting another |
| 293 // UpdateRect with the most recent size. | 296 // UpdateRect with the most recent size. |
| 294 EXPECT_TRUE(browser_plugin->pending_damage_buffer_); | 297 EXPECT_TRUE(browser_plugin->pending_damage_buffer_); |
| 295 } | 298 } |
| 296 // Send the BrowserPlugin another UpdateRect, but this time with a size | 299 // Send the BrowserPlugin another UpdateRect, but this time with a size |
| 297 // that matches the size of the container. | 300 // that matches the size of the container. |
| 298 { | 301 { |
| 299 BrowserPluginMsg_UpdateRect_Params update_rect_params; | 302 BrowserPluginMsg_UpdateRect_Params update_rect_params; |
| 300 update_rect_params.view_size = gfx::Size(643, 480); | 303 update_rect_params.view_size = gfx::Size(643, 480); |
| 301 update_rect_params.scale_factor = 1.0f; | 304 update_rect_params.scale_factor = 1.0f; |
| 302 update_rect_params.is_resize_ack = true; | 305 update_rect_params.is_resize_ack = true; |
| 303 update_rect_params.damage_buffer_identifier = | 306 update_rect_params.damage_buffer_identifier = |
| 304 #if defined(OS_MACOSX) | 307 #if defined(OS_MACOSX) |
| 305 browser_plugin->pending_damage_buffer_->id(); | 308 browser_plugin->pending_damage_buffer_->id(); |
| 306 #else | 309 #else |
| 307 browser_plugin->pending_damage_buffer_->handle(); | 310 browser_plugin->pending_damage_buffer_->handle(); |
| 308 #endif | 311 #endif |
| 309 browser_plugin->UpdateRect(0, update_rect_params); | 312 browser_plugin->ReceiveMessage( |
| 313 new BrowserPluginMsg_UpdateRect(0, instance_id, 0, update_rect_params)); | |
| 310 // The BrowserPlugin has finally received an UpdateRect that satisifes | 314 // The BrowserPlugin has finally received an UpdateRect that satisifes |
| 311 // its current size, and so it is happy. | 315 // its current size, and so it is happy. |
| 312 EXPECT_FALSE(browser_plugin->pending_damage_buffer_); | 316 EXPECT_FALSE(browser_plugin->pending_damage_buffer_); |
| 313 } | 317 } |
| 314 } | 318 } |
| 315 | 319 |
| 316 TEST_F(BrowserPluginTest, GuestCrash) { | 320 TEST_F(BrowserPluginTest, GuestCrash) { |
| 317 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); | 321 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); |
| 318 | 322 |
| 319 // Grab the BrowserPlugin's instance ID from its resize message. | 323 // Grab the BrowserPlugin's instance ID from its resize message. |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 342 "var msg;" | 346 "var msg;" |
| 343 "function exitListener(e) {" | 347 "function exitListener(e) {" |
| 344 " msg = JSON.parse(e.detail).reason;" | 348 " msg = JSON.parse(e.detail).reason;" |
| 345 "}" | 349 "}" |
| 346 "document.getElementById('browserplugin')." | 350 "document.getElementById('browserplugin')." |
| 347 " addEventListener('-internal-exit', exitListener);"; | 351 " addEventListener('-internal-exit', exitListener);"; |
| 348 | 352 |
| 349 ExecuteJavaScript(kAddEventListener); | 353 ExecuteJavaScript(kAddEventListener); |
| 350 | 354 |
| 351 // Pretend that the guest has terminated normally. | 355 // Pretend that the guest has terminated normally. |
| 352 browser_plugin->GuestGone(0, base::TERMINATION_STATUS_NORMAL_TERMINATION); | 356 browser_plugin->ReceiveMessage( |
| 357 new BrowserPluginMsg_GuestGone( | |
| 358 0, 0, 0, base::TERMINATION_STATUS_NORMAL_TERMINATION)); | |
| 353 | 359 |
| 354 // Verify that our event listener has fired. | 360 // Verify that our event listener has fired. |
| 355 EXPECT_EQ("normal", ExecuteScriptAndReturnString("msg")); | 361 EXPECT_EQ("normal", ExecuteScriptAndReturnString("msg")); |
| 356 | 362 |
| 357 // Pretend that the guest has crashed. | 363 // Pretend that the guest has crashed. |
| 358 browser_plugin->GuestGone(0, base::TERMINATION_STATUS_PROCESS_CRASHED); | 364 browser_plugin->ReceiveMessage( |
| 365 new BrowserPluginMsg_GuestGone( | |
| 366 0, 0, 0, base::TERMINATION_STATUS_PROCESS_CRASHED)); | |
| 359 | 367 |
| 360 // Verify that our event listener has fired. | 368 // Verify that our event listener has fired. |
| 361 EXPECT_EQ("crashed", ExecuteScriptAndReturnString("msg")); | 369 EXPECT_EQ("crashed", ExecuteScriptAndReturnString("msg")); |
| 362 | 370 |
| 363 // Send an event and verify that events are no longer deported. | 371 // Send an event and verify that events are no longer deported. |
| 364 browser_plugin->handleInputEvent(WebKit::WebMouseEvent(), | 372 browser_plugin->handleInputEvent(WebKit::WebMouseEvent(), |
| 365 cursor_info); | 373 cursor_info); |
| 366 EXPECT_FALSE(browser_plugin_manager()->sink().GetUniqueMessageMatching( | 374 EXPECT_FALSE(browser_plugin_manager()->sink().GetUniqueMessageMatching( |
| 367 BrowserPluginHostMsg_HandleInputEvent::ID)); | 375 BrowserPluginHostMsg_HandleInputEvent::ID)); |
| 368 } | 376 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 410 MockBrowserPlugin* browser_plugin = | 418 MockBrowserPlugin* browser_plugin = |
| 411 static_cast<MockBrowserPlugin*>( | 419 static_cast<MockBrowserPlugin*>( |
| 412 browser_plugin_manager()->GetBrowserPlugin(instance_id)); | 420 browser_plugin_manager()->GetBrowserPlugin(instance_id)); |
| 413 ASSERT_TRUE(browser_plugin); | 421 ASSERT_TRUE(browser_plugin); |
| 414 | 422 |
| 415 { | 423 { |
| 416 BrowserPluginMsg_LoadCommit_Params navigate_params; | 424 BrowserPluginMsg_LoadCommit_Params navigate_params; |
| 417 navigate_params.is_top_level = true; | 425 navigate_params.is_top_level = true; |
| 418 navigate_params.url = GURL(kGoogleURL); | 426 navigate_params.url = GURL(kGoogleURL); |
| 419 navigate_params.process_id = 1337; | 427 navigate_params.process_id = 1337; |
| 420 browser_plugin->LoadCommit(navigate_params); | 428 browser_plugin->ReceiveMessage( |
| 429 new BrowserPluginMsg_LoadCommit(0, instance_id, navigate_params)); | |
| 421 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); | 430 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); |
| 422 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString(kGetSrc)); | 431 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString(kGetSrc)); |
| 423 EXPECT_EQ(1337, ExecuteScriptAndReturnInt(kGetProcessID)); | 432 EXPECT_EQ(1337, ExecuteScriptAndReturnInt(kGetProcessID)); |
| 424 } | 433 } |
| 425 ExecuteJavaScript(kRemoveEventListener); | 434 ExecuteJavaScript(kRemoveEventListener); |
| 426 { | 435 { |
| 427 BrowserPluginMsg_LoadCommit_Params navigate_params; | 436 BrowserPluginMsg_LoadCommit_Params navigate_params; |
| 428 navigate_params.is_top_level = false; | 437 navigate_params.is_top_level = false; |
| 429 navigate_params.url = GURL(kGoogleNewsURL); | 438 navigate_params.url = GURL(kGoogleNewsURL); |
| 430 navigate_params.process_id = 42; | 439 navigate_params.process_id = 42; |
| 431 browser_plugin->LoadCommit(navigate_params); | 440 browser_plugin->ReceiveMessage( |
| 441 new BrowserPluginMsg_LoadCommit(0, instance_id, navigate_params)); | |
| 432 // The URL variable should not change because we've removed the event | 442 // The URL variable should not change because we've removed the event |
| 433 // listener. | 443 // listener. |
| 434 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); | 444 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); |
| 435 // The src attribute should not change if this is a top-level navigation. | 445 // The src attribute should not change if this is a top-level navigation. |
| 436 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString(kGetSrc)); | 446 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString(kGetSrc)); |
| 437 EXPECT_EQ(42, ExecuteScriptAndReturnInt(kGetProcessID)); | 447 EXPECT_EQ(42, ExecuteScriptAndReturnInt(kGetProcessID)); |
| 438 } | 448 } |
| 439 } | 449 } |
| 440 | 450 |
| 441 TEST_F(BrowserPluginTest, StopMethod) { | 451 TEST_F(BrowserPluginTest, StopMethod) { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 639 | 649 |
| 640 MockBrowserPlugin* browser_plugin = | 650 MockBrowserPlugin* browser_plugin = |
| 641 static_cast<MockBrowserPlugin*>( | 651 static_cast<MockBrowserPlugin*>( |
| 642 browser_plugin_manager()->GetBrowserPlugin(instance_id)); | 652 browser_plugin_manager()->GetBrowserPlugin(instance_id)); |
| 643 ASSERT_TRUE(browser_plugin); | 653 ASSERT_TRUE(browser_plugin); |
| 644 | 654 |
| 645 { | 655 { |
| 646 BrowserPluginMsg_LoadCommit_Params navigate_params; | 656 BrowserPluginMsg_LoadCommit_Params navigate_params; |
| 647 navigate_params.url = GURL(kGoogleURL); | 657 navigate_params.url = GURL(kGoogleURL); |
| 648 navigate_params.process_id = 1337; | 658 navigate_params.process_id = 1337; |
| 649 browser_plugin->LoadCommit(navigate_params); | 659 browser_plugin->ReceiveMessage( |
| 660 new BrowserPluginMsg_LoadCommit(0, instance_id, navigate_params)); | |
| 650 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); | 661 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); |
| 651 EXPECT_EQ(1337, ExecuteScriptAndReturnInt(kGetProcessID)); | 662 EXPECT_EQ(1337, ExecuteScriptAndReturnInt(kGetProcessID)); |
| 652 } | 663 } |
| 653 { | 664 { |
| 654 BrowserPluginMsg_LoadCommit_Params navigate_params; | 665 BrowserPluginMsg_LoadCommit_Params navigate_params; |
| 655 navigate_params.url = GURL(kGoogleNewsURL); | 666 navigate_params.url = GURL(kGoogleNewsURL); |
| 656 navigate_params.process_id = 42; | 667 navigate_params.process_id = 42; |
| 657 browser_plugin->LoadCommit(navigate_params); | 668 browser_plugin->ReceiveMessage( |
| 669 new BrowserPluginMsg_LoadCommit(0, instance_id, navigate_params)); | |
| 658 // The URL variable should not change because we've removed the event | 670 // The URL variable should not change because we've removed the event |
| 659 // listener. | 671 // listener. |
| 660 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); | 672 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); |
| 661 EXPECT_EQ(42, ExecuteScriptAndReturnInt(kGetProcessID)); | 673 EXPECT_EQ(42, ExecuteScriptAndReturnInt(kGetProcessID)); |
| 662 } | 674 } |
| 663 } | 675 } |
| 664 | 676 |
| 665 // This test verifies that multiple event listeners fire that are registered | 677 // This test verifies that multiple event listeners fire that are registered |
| 666 // on a single event type. | 678 // on a single event type. |
| 667 TEST_F(BrowserPluginTest, MultipleEventListeners) { | 679 TEST_F(BrowserPluginTest, MultipleEventListeners) { |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 694 | 706 |
| 695 MockBrowserPlugin* browser_plugin = | 707 MockBrowserPlugin* browser_plugin = |
| 696 static_cast<MockBrowserPlugin*>( | 708 static_cast<MockBrowserPlugin*>( |
| 697 browser_plugin_manager()->GetBrowserPlugin(instance_id)); | 709 browser_plugin_manager()->GetBrowserPlugin(instance_id)); |
| 698 ASSERT_TRUE(browser_plugin); | 710 ASSERT_TRUE(browser_plugin); |
| 699 | 711 |
| 700 { | 712 { |
| 701 BrowserPluginMsg_LoadCommit_Params navigate_params; | 713 BrowserPluginMsg_LoadCommit_Params navigate_params; |
| 702 navigate_params.url = GURL(kGoogleURL); | 714 navigate_params.url = GURL(kGoogleURL); |
| 703 navigate_params.process_id = 1337; | 715 navigate_params.process_id = 1337; |
| 704 browser_plugin->LoadCommit(navigate_params); | 716 browser_plugin->ReceiveMessage( |
| 717 new BrowserPluginMsg_LoadCommit(0, instance_id, navigate_params)); | |
| 705 EXPECT_EQ(2, ExecuteScriptAndReturnInt("count")); | 718 EXPECT_EQ(2, ExecuteScriptAndReturnInt("count")); |
| 706 EXPECT_EQ(1337, ExecuteScriptAndReturnInt(kGetProcessID)); | 719 EXPECT_EQ(1337, ExecuteScriptAndReturnInt(kGetProcessID)); |
| 707 } | 720 } |
| 708 } | 721 } |
| 709 | 722 |
| 710 TEST_F(BrowserPluginTest, RemoveBrowserPluginOnExit) { | 723 TEST_F(BrowserPluginTest, RemoveBrowserPluginOnExit) { |
| 711 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); | 724 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); |
| 712 | 725 |
| 713 // Grab the BrowserPlugin's instance ID from its resize message. | 726 // Grab the BrowserPlugin's instance ID from its resize message. |
| 714 const IPC::Message* msg = | 727 const IPC::Message* msg = |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 730 " var bp = document.getElementById('browserplugin');" | 743 " var bp = document.getElementById('browserplugin');" |
| 731 " bp.parentNode.removeChild(bp);" | 744 " bp.parentNode.removeChild(bp);" |
| 732 " }" | 745 " }" |
| 733 "}" | 746 "}" |
| 734 "document.getElementById('browserplugin')." | 747 "document.getElementById('browserplugin')." |
| 735 " addEventListener('-internal-exit', exitListener);"; | 748 " addEventListener('-internal-exit', exitListener);"; |
| 736 | 749 |
| 737 ExecuteJavaScript(kAddEventListener); | 750 ExecuteJavaScript(kAddEventListener); |
| 738 | 751 |
| 739 // Pretend that the guest has crashed. | 752 // Pretend that the guest has crashed. |
| 740 browser_plugin->GuestGone(0, base::TERMINATION_STATUS_PROCESS_WAS_KILLED); | 753 browser_plugin->ReceiveMessage( |
| 754 new BrowserPluginMsg_GuestGone( | |
| 755 0, instance_id, 0, base::TERMINATION_STATUS_PROCESS_WAS_KILLED)); | |
| 741 | 756 |
| 742 ProcessPendingMessages(); | 757 ProcessPendingMessages(); |
| 743 | 758 |
| 744 EXPECT_EQ(NULL, browser_plugin_manager()->GetBrowserPlugin(instance_id)); | 759 EXPECT_EQ(NULL, browser_plugin_manager()->GetBrowserPlugin(instance_id)); |
| 745 } | 760 } |
| 746 | 761 |
| 747 TEST_F(BrowserPluginTest, AutoSizeAttributes) { | 762 TEST_F(BrowserPluginTest, AutoSizeAttributes) { |
| 748 std::string html = StringPrintf(kHTMLForSourcelessPluginObject, | 763 std::string html = StringPrintf(kHTMLForSourcelessPluginObject, |
| 749 content::kBrowserPluginMimeType); | 764 content::kBrowserPluginMimeType); |
| 750 LoadHTML(html.c_str()); | 765 LoadHTML(html.c_str()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 803 BrowserPluginMsg_UpdateRect_Params update_rect_params; | 818 BrowserPluginMsg_UpdateRect_Params update_rect_params; |
| 804 update_rect_params.damage_buffer_identifier = | 819 update_rect_params.damage_buffer_identifier = |
| 805 #if defined(OS_MACOSX) | 820 #if defined(OS_MACOSX) |
| 806 browser_plugin->pending_damage_buffer_->id(); | 821 browser_plugin->pending_damage_buffer_->id(); |
| 807 #else | 822 #else |
| 808 browser_plugin->pending_damage_buffer_->handle(); | 823 browser_plugin->pending_damage_buffer_->handle(); |
| 809 #endif | 824 #endif |
| 810 update_rect_params.view_size = gfx::Size(1337, 1338); | 825 update_rect_params.view_size = gfx::Size(1337, 1338); |
| 811 update_rect_params.scale_factor = 1.0f; | 826 update_rect_params.scale_factor = 1.0f; |
| 812 update_rect_params.is_resize_ack = true; | 827 update_rect_params.is_resize_ack = true; |
| 813 browser_plugin->UpdateRect(0, update_rect_params); | 828 browser_plugin->ReceiveMessage( |
| 829 new BrowserPluginMsg_UpdateRect(0, instance_id, 0, update_rect_params)); | |
| 814 | 830 |
| 815 // Verify that the autosize state has been updated. | 831 // Verify that the autosize state has been updated. |
| 816 { | 832 { |
| 817 const IPC::Message* auto_size_msg = | 833 const IPC::Message* auto_size_msg = |
| 818 browser_plugin_manager()->sink().GetUniqueMessageMatching( | 834 browser_plugin_manager()->sink().GetUniqueMessageMatching( |
| 819 BrowserPluginHostMsg_UpdateRect_ACK::ID); | 835 BrowserPluginHostMsg_UpdateRect_ACK::ID); |
| 820 ASSERT_TRUE(auto_size_msg); | 836 ASSERT_TRUE(auto_size_msg); |
| 821 | 837 |
| 822 int instance_id = -1; | 838 int instance_id = -1; |
| 823 int message_id = 0; | 839 int message_id = 0; |
| 824 BrowserPluginHostMsg_AutoSize_Params auto_size_params; | 840 BrowserPluginHostMsg_AutoSize_Params auto_size_params; |
| 825 BrowserPluginHostMsg_ResizeGuest_Params resize_params; | 841 BrowserPluginHostMsg_ResizeGuest_Params resize_params; |
| 826 BrowserPluginHostMsg_UpdateRect_ACK::Read(auto_size_msg, | 842 BrowserPluginHostMsg_UpdateRect_ACK::Read(auto_size_msg, |
| 827 &instance_id, | 843 &instance_id, |
| 828 &message_id, | 844 &message_id, |
| 829 &auto_size_params, | 845 &auto_size_params, |
| 830 &resize_params); | 846 &resize_params); |
| 831 EXPECT_FALSE(auto_size_params.enable); | 847 EXPECT_FALSE(auto_size_params.enable); |
| 832 EXPECT_EQ(42, auto_size_params.min_size.width()); | 848 EXPECT_EQ(42, auto_size_params.min_size.width()); |
| 833 EXPECT_EQ(43, auto_size_params.min_size.height()); | 849 EXPECT_EQ(43, auto_size_params.min_size.height()); |
| 834 EXPECT_EQ(1337, auto_size_params.max_size.width()); | 850 EXPECT_EQ(1337, auto_size_params.max_size.width()); |
| 835 EXPECT_EQ(1338, auto_size_params.max_size.height()); | 851 EXPECT_EQ(1338, auto_size_params.max_size.height()); |
| 836 } | 852 } |
| 837 } | 853 } |
| 838 | 854 |
| 839 } // namespace content | 855 } // namespace content |
| OLD | NEW |