Chromium Code Reviews| Index: content/renderer/browser_plugin/browser_plugin_browsertest.cc |
| diff --git a/content/renderer/browser_plugin/browser_plugin_browsertest.cc b/content/renderer/browser_plugin/browser_plugin_browsertest.cc |
| index 2503fa5ebf54a5b8d717ead8c47ede2df094dc22..9448cc901c276b592e257456bf3eaca309b41598 100644 |
| --- a/content/renderer/browser_plugin/browser_plugin_browsertest.cc |
| +++ b/content/renderer/browser_plugin/browser_plugin_browsertest.cc |
| @@ -156,7 +156,8 @@ TEST_F(BrowserPluginTest, InitialResize) { |
| update_rect_params.view_size = gfx::Size(640, 480); |
| update_rect_params.scale_factor = 1.0f; |
| update_rect_params.is_resize_ack = true; |
| - browser_plugin->UpdateRect(0, update_rect_params); |
| + browser_plugin->ReceiveMessage( |
| + 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.
|
| EXPECT_FALSE(browser_plugin->pending_damage_buffer_); |
| } |
| @@ -246,7 +247,8 @@ TEST_F(BrowserPluginTest, ResizeFlowControl) { |
| #else |
| browser_plugin->pending_damage_buffer_->handle(); |
| #endif |
| - browser_plugin->UpdateRect(0, update_rect_params); |
| + browser_plugin->ReceiveMessage( |
| + new BrowserPluginMsg_UpdateRect(0, instance_id, 0, update_rect_params)); |
| EXPECT_EQ(NULL, browser_plugin->pending_damage_buffer_); |
| } |
| @@ -288,7 +290,8 @@ TEST_F(BrowserPluginTest, ResizeFlowControl) { |
| #else |
| browser_plugin->pending_damage_buffer_->handle(); |
| #endif |
| - browser_plugin->UpdateRect(0, update_rect_params); |
| + browser_plugin->ReceiveMessage( |
| + new BrowserPluginMsg_UpdateRect(0, instance_id, 0, update_rect_params)); |
| // This tells us that the BrowserPlugin is still expecting another |
| // UpdateRect with the most recent size. |
| EXPECT_TRUE(browser_plugin->pending_damage_buffer_); |
| @@ -306,7 +309,8 @@ TEST_F(BrowserPluginTest, ResizeFlowControl) { |
| #else |
| browser_plugin->pending_damage_buffer_->handle(); |
| #endif |
| - browser_plugin->UpdateRect(0, update_rect_params); |
| + browser_plugin->ReceiveMessage( |
| + new BrowserPluginMsg_UpdateRect(0, instance_id, 0, update_rect_params)); |
| // The BrowserPlugin has finally received an UpdateRect that satisifes |
| // its current size, and so it is happy. |
| EXPECT_FALSE(browser_plugin->pending_damage_buffer_); |
| @@ -349,13 +353,17 @@ TEST_F(BrowserPluginTest, GuestCrash) { |
| ExecuteJavaScript(kAddEventListener); |
| // Pretend that the guest has terminated normally. |
| - browser_plugin->GuestGone(0, base::TERMINATION_STATUS_NORMAL_TERMINATION); |
| + browser_plugin->ReceiveMessage( |
| + new BrowserPluginMsg_GuestGone( |
| + 0, 0, 0, base::TERMINATION_STATUS_NORMAL_TERMINATION)); |
| // Verify that our event listener has fired. |
| EXPECT_EQ("normal", ExecuteScriptAndReturnString("msg")); |
| // Pretend that the guest has crashed. |
| - browser_plugin->GuestGone(0, base::TERMINATION_STATUS_PROCESS_CRASHED); |
| + browser_plugin->ReceiveMessage( |
| + new BrowserPluginMsg_GuestGone( |
| + 0, 0, 0, base::TERMINATION_STATUS_PROCESS_CRASHED)); |
| // Verify that our event listener has fired. |
| EXPECT_EQ("crashed", ExecuteScriptAndReturnString("msg")); |
| @@ -417,7 +425,8 @@ TEST_F(BrowserPluginTest, CustomEvents) { |
| navigate_params.is_top_level = true; |
| navigate_params.url = GURL(kGoogleURL); |
| navigate_params.process_id = 1337; |
| - browser_plugin->LoadCommit(navigate_params); |
| + browser_plugin->ReceiveMessage( |
| + new BrowserPluginMsg_LoadCommit(0, instance_id, navigate_params)); |
| EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); |
| EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString(kGetSrc)); |
| EXPECT_EQ(1337, ExecuteScriptAndReturnInt(kGetProcessID)); |
| @@ -428,7 +437,8 @@ TEST_F(BrowserPluginTest, CustomEvents) { |
| navigate_params.is_top_level = false; |
| navigate_params.url = GURL(kGoogleNewsURL); |
| navigate_params.process_id = 42; |
| - browser_plugin->LoadCommit(navigate_params); |
| + browser_plugin->ReceiveMessage( |
| + new BrowserPluginMsg_LoadCommit(0, instance_id, navigate_params)); |
| // The URL variable should not change because we've removed the event |
| // listener. |
| EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); |
| @@ -646,7 +656,8 @@ TEST_F(BrowserPluginTest, RemoveEventListenerInEventListener) { |
| BrowserPluginMsg_LoadCommit_Params navigate_params; |
| navigate_params.url = GURL(kGoogleURL); |
| navigate_params.process_id = 1337; |
| - browser_plugin->LoadCommit(navigate_params); |
| + browser_plugin->ReceiveMessage( |
| + new BrowserPluginMsg_LoadCommit(0, instance_id, navigate_params)); |
| EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); |
| EXPECT_EQ(1337, ExecuteScriptAndReturnInt(kGetProcessID)); |
| } |
| @@ -654,7 +665,8 @@ TEST_F(BrowserPluginTest, RemoveEventListenerInEventListener) { |
| BrowserPluginMsg_LoadCommit_Params navigate_params; |
| navigate_params.url = GURL(kGoogleNewsURL); |
| navigate_params.process_id = 42; |
| - browser_plugin->LoadCommit(navigate_params); |
| + browser_plugin->ReceiveMessage( |
| + new BrowserPluginMsg_LoadCommit(0, instance_id, navigate_params)); |
| // The URL variable should not change because we've removed the event |
| // listener. |
| EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); |
| @@ -701,7 +713,8 @@ TEST_F(BrowserPluginTest, MultipleEventListeners) { |
| BrowserPluginMsg_LoadCommit_Params navigate_params; |
| navigate_params.url = GURL(kGoogleURL); |
| navigate_params.process_id = 1337; |
| - browser_plugin->LoadCommit(navigate_params); |
| + browser_plugin->ReceiveMessage( |
| + new BrowserPluginMsg_LoadCommit(0, instance_id, navigate_params)); |
| EXPECT_EQ(2, ExecuteScriptAndReturnInt("count")); |
| EXPECT_EQ(1337, ExecuteScriptAndReturnInt(kGetProcessID)); |
| } |
| @@ -737,7 +750,9 @@ TEST_F(BrowserPluginTest, RemoveBrowserPluginOnExit) { |
| ExecuteJavaScript(kAddEventListener); |
| // Pretend that the guest has crashed. |
| - browser_plugin->GuestGone(0, base::TERMINATION_STATUS_PROCESS_WAS_KILLED); |
| + browser_plugin->ReceiveMessage( |
| + new BrowserPluginMsg_GuestGone( |
| + 0, instance_id, 0, base::TERMINATION_STATUS_PROCESS_WAS_KILLED)); |
| ProcessPendingMessages(); |
| @@ -810,7 +825,8 @@ TEST_F(BrowserPluginTest, AutoSizeAttributes) { |
| update_rect_params.view_size = gfx::Size(1337, 1338); |
| update_rect_params.scale_factor = 1.0f; |
| update_rect_params.is_resize_ack = true; |
| - browser_plugin->UpdateRect(0, update_rect_params); |
| + browser_plugin->ReceiveMessage( |
| + new BrowserPluginMsg_UpdateRect(0, instance_id, 0, update_rect_params)); |
| // Verify that the autosize state has been updated. |
| { |