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

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: Address comments from Fady + remove commented code. 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 ASSERT_TRUE(test_server()->Start()); 227 ASSERT_TRUE(test_server()->Start());
228 GURL test_url(test_server()->GetURL( 228 GURL test_url(test_server()->GetURL(
229 "files/browser_plugin_embedder.html")); 229 "files/browser_plugin_embedder.html"));
230 NavigateToURL(shell(), test_url); 230 NavigateToURL(shell(), test_url);
231 231
232 WebContentsImpl* embedder_web_contents = static_cast<WebContentsImpl*>( 232 WebContentsImpl* embedder_web_contents = static_cast<WebContentsImpl*>(
233 shell()->web_contents()); 233 shell()->web_contents());
234 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 234 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
235 embedder_web_contents->GetRenderViewHost()); 235 embedder_web_contents->GetRenderViewHost());
236 236
237 int nxt_width = 100; 237 const gfx::Size nxt_size = gfx::Size(100, 200);
238 int nxt_height = 200;
239 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16( 238 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
240 StringPrintf("SetSize(%d, %d);", nxt_width, nxt_height))); 239 StringPrintf("SetSize(%d, %d);", nxt_size.width(), nxt_size.height())));
241 240
242 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16( 241 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
243 StringPrintf("SetSrc('%s');", kHTMLForGuest))); 242 StringPrintf("SetSrc('%s');", kHTMLForGuest)));
244 243
245 // Wait to make sure embedder is created/attached to WebContents. 244 // Wait to make sure embedder is created/attached to WebContents.
246 TestBrowserPluginHostFactory::GetInstance()->WaitForEmbedderCreation(); 245 TestBrowserPluginHostFactory::GetInstance()->WaitForEmbedderCreation();
247 246
248 TestBrowserPluginEmbedder* test_embedder = 247 TestBrowserPluginEmbedder* test_embedder =
249 static_cast<TestBrowserPluginEmbedder*>( 248 static_cast<TestBrowserPluginEmbedder*>(
250 embedder_web_contents->GetBrowserPluginEmbedder()); 249 embedder_web_contents->GetBrowserPluginEmbedder());
251 ASSERT_TRUE(test_embedder); 250 ASSERT_TRUE(test_embedder);
252 test_embedder->WaitForGuestAdded(); 251 test_embedder->WaitForGuestAdded();
253 252
254 // Verify that we have exactly one guest. 253 // Verify that we have exactly one guest.
255 const BrowserPluginEmbedder::ContainerInstanceMap& instance_map = 254 const BrowserPluginEmbedder::ContainerInstanceMap& instance_map =
256 test_embedder->guest_web_contents_for_testing(); 255 test_embedder->guest_web_contents_for_testing();
257 EXPECT_EQ(1u, instance_map.size()); 256 EXPECT_EQ(1u, instance_map.size());
258 257
259 WebContentsImpl* test_guest_web_contents = static_cast<WebContentsImpl*>( 258 WebContentsImpl* test_guest_web_contents = static_cast<WebContentsImpl*>(
260 instance_map.begin()->second); 259 instance_map.begin()->second);
261 TestBrowserPluginGuest* test_guest = static_cast<TestBrowserPluginGuest*>( 260 TestBrowserPluginGuest* test_guest = static_cast<TestBrowserPluginGuest*>(
262 test_guest_web_contents->GetBrowserPluginGuest()); 261 test_guest_web_contents->GetBrowserPluginGuest());
263 262
264 263 // Wait for the guest to receive a damage buffer of size 100x200.
265 // Wait for the guest to send an UpdateRectMsg, the dimensions should be 264 // This means the guest will be painted properly at that size.
266 // 100 x 200. 265 test_guest->WaitForDamageBufferWithSize(nxt_size);
267 test_guest->WaitForUpdateRectMsgWithSize(nxt_width, nxt_height);
268 } 266 }
269 267
270 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AdvanceFocus) { 268 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, AdvanceFocus) {
271 ASSERT_TRUE(test_server()->Start()); 269 ASSERT_TRUE(test_server()->Start());
272 GURL test_url(test_server()->GetURL( 270 GURL test_url(test_server()->GetURL(
273 "files/browser_plugin_focus.html")); 271 "files/browser_plugin_focus.html"));
274 NavigateToURL(shell(), test_url); 272 NavigateToURL(shell(), test_url);
275 273
276 WebContentsImpl* embedder_web_contents = static_cast<WebContentsImpl*>( 274 WebContentsImpl* embedder_web_contents = static_cast<WebContentsImpl*>(
277 shell()->web_contents()); 275 shell()->web_contents());
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 TestBrowserPluginGuest* test_guest = static_cast<TestBrowserPluginGuest*>( 561 TestBrowserPluginGuest* test_guest = static_cast<TestBrowserPluginGuest*>(
564 test_guest_web_contents->GetBrowserPluginGuest()); 562 test_guest_web_contents->GetBrowserPluginGuest());
565 test_guest->WaitForUpdateRectMsg(); 563 test_guest->WaitForUpdateRectMsg();
566 564
567 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16( 565 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
568 "document.getElementById('plugin').stop()")); 566 "document.getElementById('plugin').stop()"));
569 test_guest->WaitForStop(); 567 test_guest->WaitForStop();
570 } 568 }
571 569
572 } // namespace content 570 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698