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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 std::string result; | 683 std::string result; |
684 EXPECT_TRUE(v->GetAsString(&result)); | 684 EXPECT_TRUE(v->GetAsString(&result)); |
685 EXPECT_EQ(redirect_url.spec().c_str(), result); | 685 EXPECT_EQ(redirect_url.spec().c_str(), result); |
686 | 686 |
687 v = rvh->ExecuteJavascriptAndGetValue( | 687 v = rvh->ExecuteJavascriptAndGetValue( |
688 string16(), ASCIIToUTF16("redirectNewUrl")); | 688 string16(), ASCIIToUTF16("redirectNewUrl")); |
689 EXPECT_TRUE(v->GetAsString(&result)); | 689 EXPECT_TRUE(v->GetAsString(&result)); |
690 EXPECT_EQ(test_server()->GetURL("files/title1.html").spec().c_str(), result); | 690 EXPECT_EQ(test_server()->GetURL("files/title1.html").spec().c_str(), result); |
691 } | 691 } |
692 | 692 |
| 693 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStop) { |
| 694 const char* kEmbedderURL = "files/browser_plugin_embedder.html"; |
| 695 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); |
| 696 |
| 697 const string16 expected_title = ASCIIToUTF16("loadStop"); |
| 698 content::TitleWatcher title_watcher(test_embedder()->web_contents(), |
| 699 expected_title); |
| 700 // Renavigate the guest to |kHTMLForGuest|. |
| 701 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 702 test_embedder()->web_contents()->GetRenderViewHost()); |
| 703 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16( |
| 704 StringPrintf("SetSrc('%s');", kHTMLForGuest))); |
| 705 |
| 706 string16 actual_title = title_watcher.WaitAndGetTitle(); |
| 707 EXPECT_EQ(expected_title, actual_title); |
| 708 } |
| 709 |
| 710 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadCommit) { |
| 711 const char* kEmbedderURL = "files/browser_plugin_embedder.html"; |
| 712 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); |
| 713 |
| 714 const string16 expected_title = ASCIIToUTF16(kHTMLForGuest); |
| 715 content::TitleWatcher title_watcher(test_embedder()->web_contents(), |
| 716 expected_title); |
| 717 // Renavigate the guest to |kHTMLForGuest|. |
| 718 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 719 test_embedder()->web_contents()->GetRenderViewHost()); |
| 720 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16( |
| 721 StringPrintf("SetSrc('%s');", kHTMLForGuest))); |
| 722 |
| 723 string16 actual_title = title_watcher.WaitAndGetTitle(); |
| 724 EXPECT_EQ(expected_title, actual_title); |
| 725 base::Value* isTopLevel = rvh->ExecuteJavascriptAndGetValue( |
| 726 string16(), ASCIIToUTF16("isTopLevel")); |
| 727 bool t; |
| 728 EXPECT_TRUE(isTopLevel->GetAsBoolean(&t)); |
| 729 EXPECT_EQ(true, t); |
| 730 } |
| 731 |
693 } // namespace content | 732 } // namespace content |
OLD | NEW |