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

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

Issue 11066032: Browser Plugin: Update Guest WebContents Visibility on BrowserPlugin Visiblity Change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a test 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 EXPECT_EQ(expected_title, actual_title); 409 EXPECT_EQ(expected_title, actual_title);
410 LOG(INFO) << "Done navigating to second page"; 410 LOG(INFO) << "Done navigating to second page";
411 411
412 TestBrowserPluginEmbedder* test_embedder_after_nav = 412 TestBrowserPluginEmbedder* test_embedder_after_nav =
413 static_cast<TestBrowserPluginEmbedder*>( 413 static_cast<TestBrowserPluginEmbedder*>(
414 embedder_web_contents->GetBrowserPluginEmbedder()); 414 embedder_web_contents->GetBrowserPluginEmbedder());
415 // Embedder must not change in web_contents. 415 // Embedder must not change in web_contents.
416 ASSERT_EQ(test_embedder_after_nav, test_embedder()); 416 ASSERT_EQ(test_embedder_after_nav, test_embedder());
417 } 417 }
418 418
419 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, VisibilityChanged) { 419 // This test verifies that hiding the embedder also hides the guest.
420 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, EmbedderVisibilityChanged) {
Charlie Reis 2012/10/05 00:33:18 I think these names are backwards, right?
Fady Samuel 2012/10/05 15:22:07 Wow, you're right, I don't know how that happened
420 const char* kEmbedderURL = "files/browser_plugin_embedder.html"; 421 const char* kEmbedderURL = "files/browser_plugin_embedder.html";
421 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, ""); 422 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, "");
422 423
423 // Wait for the guest to send an UpdateRectMsg, meaning it is ready. 424 // Hide the Browser Plugin.
424 test_guest()->WaitForUpdateRectMsg(); 425 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
426 test_embedder()->web_contents()->GetRenderViewHost());
427 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
428 "document.getElementById('plugin').style.visibility = 'hidden'"));
429
430 // Make sure that the guest is hidden.
431 test_guest()->WaitUntilHidden();
432 }
433
434 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, BrowserPluginVisibilityChanged) {
435 const char* kEmbedderURL = "files/browser_plugin_embedder.html";
436 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, "");
425 437
426 // Hide the embedder. 438 // Hide the embedder.
427 test_embedder()->web_contents()->WasHidden(); 439 test_embedder()->web_contents()->WasHidden();
428 440
429 // Make sure that hiding the embedder also hides the guest. 441 // Make sure that hiding the embedder also hides the guest.
430 test_guest()->WaitUntilHidden(); 442 test_guest()->WaitUntilHidden();
431 } 443 }
432 444
433 // This test verifies that calling the reload method reloads the guest. 445 // This test verifies that calling the reload method reloads the guest.
434 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, ReloadGuest) { 446 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, ReloadGuest) {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 test_embedder()->web_contents()->GetRenderViewHost()); 664 test_embedder()->web_contents()->GetRenderViewHost());
653 GURL test_url = test_server()->GetURL("close-socket"); 665 GURL test_url = test_server()->GetURL("close-socket");
654 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16( 666 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
655 StringPrintf("SetSrc('%s');", test_url.spec().c_str()))); 667 StringPrintf("SetSrc('%s');", test_url.spec().c_str())));
656 668
657 string16 actual_title = title_watcher.WaitAndGetTitle(); 669 string16 actual_title = title_watcher.WaitAndGetTitle();
658 EXPECT_EQ(expected_title, actual_title); 670 EXPECT_EQ(expected_title, actual_title);
659 } 671 }
660 672
661 } // namespace content 673 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698