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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/singleton.h" | 6 #include "base/memory/singleton.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 10 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
702 std::string result; | 702 std::string result; |
703 EXPECT_TRUE(v->GetAsString(&result)); | 703 EXPECT_TRUE(v->GetAsString(&result)); |
704 EXPECT_EQ(redirect_url.spec().c_str(), result); | 704 EXPECT_EQ(redirect_url.spec().c_str(), result); |
705 | 705 |
706 v = rvh->ExecuteJavascriptAndGetValue( | 706 v = rvh->ExecuteJavascriptAndGetValue( |
707 string16(), ASCIIToUTF16("redirectNewUrl")); | 707 string16(), ASCIIToUTF16("redirectNewUrl")); |
708 EXPECT_TRUE(v->GetAsString(&result)); | 708 EXPECT_TRUE(v->GetAsString(&result)); |
709 EXPECT_EQ(test_server()->GetURL("files/title1.html").spec().c_str(), result); | 709 EXPECT_EQ(test_server()->GetURL("files/title1.html").spec().c_str(), result); |
710 } | 710 } |
711 | 711 |
712 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStop) { | |
713 const char* kEmbedderURL = "files/browser_plugin_embedder.html"; | |
714 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); | |
715 | |
716 const string16 expected_title = ASCIIToUTF16("loadStop"); | |
717 content::TitleWatcher title_watcher(test_embedder()->web_contents(), | |
718 expected_title); | |
719 // Renavigate the guest to |kHTMLForGuest|. | |
720 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | |
721 test_embedder()->web_contents()->GetRenderViewHost()); | |
722 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16( | |
723 StringPrintf("SetSrc('%s');", kHTMLForGuest))); | |
724 | |
725 string16 actual_title = title_watcher.WaitAndGetTitle(); | |
726 EXPECT_EQ(expected_title, actual_title); | |
727 } | |
728 | |
729 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadCommit) { | |
730 const char* kEmbedderURL = "files/browser_plugin_embedder.html"; | |
731 StartBrowserPluginTest(kEmbedderURL, "about:blank", true, ""); | |
732 | |
733 const string16 expected_title = ASCIIToUTF16(kHTMLForGuest); | |
734 content::TitleWatcher title_watcher(test_embedder()->web_contents(), | |
735 expected_title); | |
736 // Renavigate the guest to |kHTMLForGuest|. | |
737 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | |
738 test_embedder()->web_contents()->GetRenderViewHost()); | |
739 rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16( | |
740 StringPrintf("SetSrc('%s');", kHTMLForGuest))); | |
741 | |
742 string16 actual_title = title_watcher.WaitAndGetTitle(); | |
743 EXPECT_EQ(expected_title, actual_title); | |
744 base::Value* isTopLevel = rvh->ExecuteJavascriptAndGetValue( | |
745 string16(), ASCIIToUTF16("isTopLevel")); | |
Fady Samuel
2012/10/11 15:25:36
The spacing is wrong here. It should be 4 spaces f
irobert
2012/10/11 16:50:44
Done.
| |
746 bool t; | |
747 EXPECT_TRUE(isTopLevel->GetAsBoolean(&t)); | |
748 EXPECT_EQ(true, t); | |
749 } | |
750 | |
712 } // namespace content | 751 } // namespace content |
OLD | NEW |