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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_host_browsertest.cc

Issue 10965048: [BrowserTag] Send dib info with NavigateGuest message, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync @tott, correct rebase, bring back two lost comments from previous rounds Created 8 years, 2 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 "base/memory/singleton.h" 5 #include "base/memory/singleton.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/test/test_timeouts.h" 7 #include "base/test/test_timeouts.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "content/browser/browser_plugin/browser_plugin_guest.h" 9 #include "content/browser/browser_plugin/browser_plugin_guest.h"
10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" 10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 ASSERT_TRUE(test_server()->Start()); 296 ASSERT_TRUE(test_server()->Start());
297 GURL test_url(test_server()->GetURL( 297 GURL test_url(test_server()->GetURL(
298 "files/browser_plugin_embedder.html")); 298 "files/browser_plugin_embedder.html"));
299 NavigateToURL(shell(), test_url); 299 NavigateToURL(shell(), test_url);
300 300
301 WebContentsImpl* embedder_web_contents = static_cast<WebContentsImpl*>( 301 WebContentsImpl* embedder_web_contents = static_cast<WebContentsImpl*>(
302 shell()->web_contents()); 302 shell()->web_contents());
303 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 303 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
304 embedder_web_contents->GetRenderViewHost()); 304 embedder_web_contents->GetRenderViewHost());
305 305
306 int nxt_width = 100; 306 const gfx::Size nxt_size = gfx::Size(100, 200);
307 int nxt_height = 200;
308 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16( 307 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
309 StringPrintf("SetSize(%d, %d);", nxt_width, nxt_height))); 308 StringPrintf("SetSize(%d, %d);", nxt_size.width(), nxt_size.height())));
310 309
311 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16( 310 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
312 StringPrintf("SetSrc('%s');", kHTMLForGuest))); 311 StringPrintf("SetSrc('%s');", kHTMLForGuest)));
313 312
314 // Wait to make sure embedder is created/attached to WebContents. 313 // Wait to make sure embedder is created/attached to WebContents.
315 TestBrowserPluginHostFactory::GetInstance()->WaitForEmbedderCreation(); 314 TestBrowserPluginHostFactory::GetInstance()->WaitForEmbedderCreation();
316 315
317 TestBrowserPluginEmbedder* test_embedder = 316 TestBrowserPluginEmbedder* test_embedder =
318 static_cast<TestBrowserPluginEmbedder*>( 317 static_cast<TestBrowserPluginEmbedder*>(
319 embedder_web_contents->GetBrowserPluginEmbedder()); 318 embedder_web_contents->GetBrowserPluginEmbedder());
320 ASSERT_TRUE(test_embedder); 319 ASSERT_TRUE(test_embedder);
321 test_embedder->WaitForGuestAdded(); 320 test_embedder->WaitForGuestAdded();
322 321
323 // Verify that we have exactly one guest. 322 // Verify that we have exactly one guest.
324 const BrowserPluginEmbedder::ContainerInstanceMap& instance_map = 323 const BrowserPluginEmbedder::ContainerInstanceMap& instance_map =
325 test_embedder->guest_web_contents_for_testing(); 324 test_embedder->guest_web_contents_for_testing();
326 EXPECT_EQ(1u, instance_map.size()); 325 EXPECT_EQ(1u, instance_map.size());
327 326
328 WebContentsImpl* test_guest_web_contents = static_cast<WebContentsImpl*>( 327 WebContentsImpl* test_guest_web_contents = static_cast<WebContentsImpl*>(
329 instance_map.begin()->second); 328 instance_map.begin()->second);
330 TestBrowserPluginGuest* test_guest = static_cast<TestBrowserPluginGuest*>( 329 TestBrowserPluginGuest* test_guest = static_cast<TestBrowserPluginGuest*>(
331 test_guest_web_contents->GetBrowserPluginGuest()); 330 test_guest_web_contents->GetBrowserPluginGuest());
332 331
333 332 // Wait for the guest to receive a damage buffer of size 100x200.
334 // Wait for the guest to send an UpdateRectMsg, the dimensions should be 333 // This means the guest will be painted properly at that size.
335 // 100 x 200. 334 test_guest->WaitForDamageBufferWithSize(nxt_size);
336 test_guest->WaitForUpdateRectMsgWithSize(nxt_width, nxt_height);
337 } 335 }
338 336
339 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AdvanceFocus) { 337 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AdvanceFocus) {
340 ASSERT_TRUE(test_server()->Start()); 338 ASSERT_TRUE(test_server()->Start());
341 GURL test_url(test_server()->GetURL( 339 GURL test_url(test_server()->GetURL(
342 "files/browser_plugin_focus.html")); 340 "files/browser_plugin_focus.html"));
343 NavigateToURL(shell(), test_url); 341 NavigateToURL(shell(), test_url);
344 342
345 WebContentsImpl* embedder_web_contents = static_cast<WebContentsImpl*>( 343 WebContentsImpl* embedder_web_contents = static_cast<WebContentsImpl*>(
346 shell()->web_contents()); 344 shell()->web_contents());
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 790
793 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16("Go(-2);")); 791 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16("Go(-2);"));
794 792
795 string16 actual_title = title_watcher.WaitAndGetTitle(); 793 string16 actual_title = title_watcher.WaitAndGetTitle();
796 EXPECT_EQ(expected_title, actual_title); 794 EXPECT_EQ(expected_title, actual_title);
797 } 795 }
798 } 796 }
799 797
800 798
801 } // namespace content 799 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/browser/browser_plugin/test_browser_plugin_guest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698