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

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

Issue 11027065: Browser plugin: Implement titleChanged event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for pages with no title 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
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/common/browser_plugin_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e883fc01c138044e1cb57586ff5b38c252036a92..9edab6d1af1859bed5f475013dd928c788f5e1d4 100644
--- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
+++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
@@ -1010,6 +1010,55 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadCommit) {
EXPECT_EQ(true, top_level_bool);
}
+IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, TitleChange) {
+ const char* kEmbedderURL = "files/browser_plugin_embedder_titlechange.html";
+ StartBrowserPluginTest(kEmbedderURL, "about:blank", true, "");
+
+ // Navigate and wait until the title changes.
+ const string16 expected_title = ASCIIToUTF16("Title Of Awesomeness");
+ content::TitleWatcher title_watcher(test_embedder()->web_contents(),
+ expected_title);
+ GURL title_url(test_server()->GetURL("files/title2.html"));
+ RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
+ test_embedder()->web_contents()->GetRenderViewHost());
+ ExecuteSyncJSFunction(rvh, ASCIIToUTF16(StringPrintf("SetSrc('%s');",
+ title_url.spec().c_str())));
+ string16 actual_title = title_watcher.WaitAndGetTitle();
+ EXPECT_EQ(expected_title, actual_title);
+
+ // Navigate to a page with a different title and wait for the update.
+ const string16 expected_title2 = ASCIIToUTF16("Title Of More Awesomeness");
+ content::TitleWatcher title_watcher2(test_embedder()->web_contents(),
+ expected_title2);
+ GURL title_url2(test_server()->GetURL("files/title3.html"));
+ ExecuteSyncJSFunction(rvh, ASCIIToUTF16(StringPrintf("SetSrc('%s');",
+ title_url2.spec().c_str())));
+ actual_title = title_watcher2.WaitAndGetTitle();
+ EXPECT_EQ(expected_title2, actual_title);
+
+ // Go back and expect the title to revert to expected_title.
+ content::TitleWatcher title_watcher3(test_embedder()->web_contents(),
+ expected_title);
+ ExecuteSyncJSFunction(rvh, ASCIIToUTF16("Back();"));
+ actual_title = title_watcher3.WaitAndGetTitle();
+ EXPECT_EQ(expected_title, actual_title);
+
+ // Navigate to a page with no title and wait for the update.
+ // It should include the URL (host, port, path) with no http://.
+ GURL no_title_url(test_server()->GetURL("files/title1.html"));
+ std::string no_title_str = no_title_url.host();
+ no_title_str.append(":");
+ no_title_str.append(no_title_url.port());
+ no_title_str.append(no_title_url.path());
+ const string16 no_title = ASCIIToUTF16(no_title_str);
+ content::TitleWatcher title_watcher4(test_embedder()->web_contents(),
+ no_title);
+ ExecuteSyncJSFunction(rvh, ASCIIToUTF16(StringPrintf("SetSrc('%s');",
+ no_title_url.spec().c_str())));
+ actual_title = title_watcher4.WaitAndGetTitle();
+ EXPECT_EQ(no_title, actual_title);
+}
+
// This test verifies that if a browser plugin is hidden before navigation,
// the guest starts off hidden.
IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, HiddenBeforeNavigation) {
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/common/browser_plugin_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698