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

Unified Diff: content/browser/renderer_host/resource_dispatcher_host_uitest.cc

Issue 6319001: Support window.opener after a process swap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with trunk. Created 9 years, 7 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/renderer_host/resource_dispatcher_host_uitest.cc
diff --git a/content/browser/renderer_host/resource_dispatcher_host_uitest.cc b/content/browser/renderer_host/resource_dispatcher_host_uitest.cc
index 5de1430db3024530d0336f9bb065671723dfeb9d..7f2117149677ac87191ef857e63e5e90e90c2a1e 100644
--- a/content/browser/renderer_host/resource_dispatcher_host_uitest.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host_uitest.cc
@@ -193,6 +193,38 @@ TEST_F(ResourceDispatcherTest, CrossSiteOnunloadCookie) {
ASSERT_STREQ("foo", value_result.c_str());
}
+// Tests that onunload is run for cross-site requests to URLs that complete
+// without network loads (e.g., about:blank, data URLs).
+TEST_F(ResourceDispatcherTest, CrossSiteImmediateLoadOnunloadCookie) {
+ net::TestServer test_server(net::TestServer::TYPE_HTTP,
+ FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+ ASSERT_TRUE(test_server.Start());
+
+ scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(browser_proxy.get());
+ scoped_refptr<TabProxy> tab(browser_proxy->GetActiveTab());
+ ASSERT_TRUE(tab.get());
+
+ GURL url(test_server.GetURL("files/onunload_cookie.html"));
+ ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url));
+
+ // Confirm that the page has loaded (since it changes its title during load).
+ std::wstring tab_title;
+ EXPECT_TRUE(tab->GetTabTitle(&tab_title));
+ EXPECT_EQ(L"set cookie on unload", tab_title);
+
+ // Navigate to a cross-site page that loads immediately without making a
+ // network request. The unload event should still be run.
+ ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
+ tab->NavigateToURL(GURL("about:blank")));
+
+ // Check that the cookie was set.
+ std::string value_result;
+ ASSERT_TRUE(tab->GetCookieByName(url, "onunloadCookie", &value_result));
+ ASSERT_FALSE(value_result.empty());
+ ASSERT_STREQ("foo", value_result.c_str());
+}
+
// Tests that the unload handler is not run for 204 responses.
TEST_F(ResourceDispatcherTest, CrossSiteNoUnloadOn204) {
net::TestServer test_server(net::TestServer::TYPE_HTTP,
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host.cc ('k') | content/browser/renderer_host/test_render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698