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

Unified Diff: content/browser/browser_plugin/browser_plugin_host_browsertest.cc

Issue 11028019: Browser plugin: Implement loadRedirect event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflicts. 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_plugin/browser_plugin_host_browsertest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
index 88d6569e4a62ad9edb15f99bb682499e4821c5f0..0fcf028355701bb993cea1ff567cd83e2154d7e5 100644
--- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
+++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
@@ -658,4 +658,36 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadAbort) {
EXPECT_EQ(expected_title, actual_title);
}
+IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadRedirect) {
+ const char* kEmbedderURL = "files/browser_plugin_embedder.html";
+ StartBrowserPluginTest(kEmbedderURL, "about:blank", true, "");
+
+ const string16 expected_title = ASCIIToUTF16("redirected");
+ content::TitleWatcher title_watcher(test_embedder()->web_contents(),
+ expected_title);
+
+ // Navigate with a redirect and wait until the title changes.
+ GURL redirect_url(test_server()->GetURL(
+ "server-redirect?files/title1.html"));
+ RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
+ test_embedder()->web_contents()->GetRenderViewHost());
+ rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
+ StringPrintf("SetSrc('%s');", redirect_url.spec().c_str())));
+
+ string16 actual_title = title_watcher.WaitAndGetTitle();
+ EXPECT_EQ(expected_title, actual_title);
+
+ // Verify that we heard a loadRedirect during the navigation.
+ base::Value* v = rvh->ExecuteJavascriptAndGetValue(
+ string16(), ASCIIToUTF16("redirectOldUrl"));
+ std::string result;
+ EXPECT_TRUE(v->GetAsString(&result));
+ EXPECT_EQ(redirect_url.spec().c_str(), result);
+
+ v = rvh->ExecuteJavascriptAndGetValue(
+ string16(), ASCIIToUTF16("redirectNewUrl"));
+ EXPECT_TRUE(v->GetAsString(&result));
+ EXPECT_EQ(test_server()->GetURL("files/title1.html").spec().c_str(), result);
+}
+
} // namespace content
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/browser/browser_plugin/test_browser_plugin_guest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698