| OLD | NEW |
| 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 Loading... |
| 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, BrowserPluginVisibilityChanged) { |
| 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, EmbedderVisibilityChanged) { |
| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 EXPECT_TRUE(v->GetAsString(&result)); | 696 EXPECT_TRUE(v->GetAsString(&result)); |
| 685 EXPECT_EQ(redirect_url.spec().c_str(), result); | 697 EXPECT_EQ(redirect_url.spec().c_str(), result); |
| 686 | 698 |
| 687 v = rvh->ExecuteJavascriptAndGetValue( | 699 v = rvh->ExecuteJavascriptAndGetValue( |
| 688 string16(), ASCIIToUTF16("redirectNewUrl")); | 700 string16(), ASCIIToUTF16("redirectNewUrl")); |
| 689 EXPECT_TRUE(v->GetAsString(&result)); | 701 EXPECT_TRUE(v->GetAsString(&result)); |
| 690 EXPECT_EQ(test_server()->GetURL("files/title1.html").spec().c_str(), result); | 702 EXPECT_EQ(test_server()->GetURL("files/title1.html").spec().c_str(), result); |
| 691 } | 703 } |
| 692 | 704 |
| 693 } // namespace content | 705 } // namespace content |
| OLD | NEW |