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

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

Issue 11035067: Add loadCommit and loadStop Event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Comments and Nits 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/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
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);
Charlie Reis 2012/10/11 18:55:28 This will be flaky. See my comments in the html f
irobert 2012/10/11 20:45:49 Done.
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"));
746 bool t;
747 EXPECT_TRUE(isTopLevel->GetAsBoolean(&t));
748 EXPECT_EQ(true, t);
749 }
750
712 } // namespace content 751 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698