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

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

Issue 21930006: <webview>: Allocate the view instance ID from the WebView shim (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT Created 7 years, 4 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
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/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 TEST_F(BrowserPluginTest, InitialResize) { 185 TEST_F(BrowserPluginTest, InitialResize) {
186 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); 186 LoadHTML(GetHTMLForBrowserPluginObject().c_str());
187 // Verify that the information in Attach is correct. 187 // Verify that the information in Attach is correct.
188 BrowserPluginHostMsg_Attach_Params params; 188 BrowserPluginHostMsg_Attach_Params params;
189 MockBrowserPlugin* browser_plugin = GetCurrentPluginWithAttachParams(&params); 189 MockBrowserPlugin* browser_plugin = GetCurrentPluginWithAttachParams(&params);
190 190
191 EXPECT_EQ(640, params.resize_guest_params.view_rect.width()); 191 EXPECT_EQ(640, params.resize_guest_params.view_rect.width());
192 EXPECT_EQ(480, params.resize_guest_params.view_rect.height()); 192 EXPECT_EQ(480, params.resize_guest_params.view_rect.height());
193 ASSERT_TRUE(browser_plugin); 193 ASSERT_TRUE(browser_plugin);
194 // Now the browser plugin is expecting a UpdateRect resize. 194 // Now the browser plugin is expecting a UpdateRect resize.
195 int instance_id = browser_plugin->instance_id(); 195 int instance_id = browser_plugin->guest_instance_id();
196 EXPECT_TRUE(browser_plugin->pending_damage_buffer_.get()); 196 EXPECT_TRUE(browser_plugin->pending_damage_buffer_.get());
197 197
198 // Send the BrowserPlugin an UpdateRect equal to its container size with 198 // Send the BrowserPlugin an UpdateRect equal to its container size with
199 // the same damage buffer. That should clear |pending_damage_buffer_|. 199 // the same damage buffer. That should clear |pending_damage_buffer_|.
200 BrowserPluginMsg_UpdateRect_Params update_rect_params; 200 BrowserPluginMsg_UpdateRect_Params update_rect_params;
201 update_rect_params.damage_buffer_sequence_id = 201 update_rect_params.damage_buffer_sequence_id =
202 browser_plugin->damage_buffer_sequence_id_; 202 browser_plugin->damage_buffer_sequence_id_;
203 update_rect_params.view_size = gfx::Size(640, 480); 203 update_rect_params.view_size = gfx::Size(640, 480);
204 update_rect_params.scale_factor = 1.0f; 204 update_rect_params.scale_factor = 1.0f;
205 update_rect_params.is_resize_ack = true; 205 update_rect_params.is_resize_ack = true;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 ExecuteScriptAndReturnString( 282 ExecuteScriptAndReturnString(
283 "document.getElementById('browserplugin').src"); 283 "document.getElementById('browserplugin').src");
284 EXPECT_EQ("bar", src_value); 284 EXPECT_EQ("bar", src_value);
285 } 285 }
286 } 286 }
287 287
288 TEST_F(BrowserPluginTest, ResizeFlowControl) { 288 TEST_F(BrowserPluginTest, ResizeFlowControl) {
289 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); 289 LoadHTML(GetHTMLForBrowserPluginObject().c_str());
290 MockBrowserPlugin* browser_plugin = GetCurrentPlugin(); 290 MockBrowserPlugin* browser_plugin = GetCurrentPlugin();
291 ASSERT_TRUE(browser_plugin); 291 ASSERT_TRUE(browser_plugin);
292 int instance_id = browser_plugin->instance_id(); 292 int instance_id = browser_plugin->guest_instance_id();
293 EXPECT_TRUE(browser_plugin->pending_damage_buffer_.get()); 293 EXPECT_TRUE(browser_plugin->pending_damage_buffer_.get());
294 // Send an UpdateRect to the BrowserPlugin to make it use the pending damage 294 // Send an UpdateRect to the BrowserPlugin to make it use the pending damage
295 // buffer. 295 // buffer.
296 { 296 {
297 // We send a stale UpdateRect to the BrowserPlugin. 297 // We send a stale UpdateRect to the BrowserPlugin.
298 BrowserPluginMsg_UpdateRect_Params update_rect_params; 298 BrowserPluginMsg_UpdateRect_Params update_rect_params;
299 update_rect_params.view_size = gfx::Size(640, 480); 299 update_rect_params.view_size = gfx::Size(640, 480);
300 update_rect_params.scale_factor = 1.0f; 300 update_rect_params.scale_factor = 1.0f;
301 update_rect_params.is_resize_ack = true; 301 update_rect_params.is_resize_ack = true;
302 update_rect_params.needs_ack = true; 302 update_rect_params.needs_ack = true;
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 // These value are not populated (as an optimization) if autosize is 618 // These value are not populated (as an optimization) if autosize is
619 // disabled. 619 // disabled.
620 EXPECT_EQ(0, auto_size_params.min_size.width()); 620 EXPECT_EQ(0, auto_size_params.min_size.width());
621 EXPECT_EQ(0, auto_size_params.min_size.height()); 621 EXPECT_EQ(0, auto_size_params.min_size.height());
622 EXPECT_EQ(0, auto_size_params.max_size.width()); 622 EXPECT_EQ(0, auto_size_params.max_size.width());
623 EXPECT_EQ(0, auto_size_params.max_size.height()); 623 EXPECT_EQ(0, auto_size_params.max_size.height());
624 } 624 }
625 } 625 }
626 626
627 } // namespace content 627 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698