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

Unified Diff: content/browser/loader/resource_dispatcher_host_browsertest.cc

Issue 22904002: When switching processes during redirects, update the cookie policy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years, 4 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 | « no previous file | content/browser/loader/resource_dispatcher_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_dispatcher_host_browsertest.cc
diff --git a/content/browser/loader/resource_dispatcher_host_browsertest.cc b/content/browser/loader/resource_dispatcher_host_browsertest.cc
index e5a6061645e05873fffd7d61e235f2275788f604..cb8896f2e05748261416efa078aafb67206c496d 100644
--- a/content/browser/loader/resource_dispatcher_host_browsertest.cc
+++ b/content/browser/loader/resource_dispatcher_host_browsertest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "content/browser/download/download_manager_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
@@ -15,6 +16,8 @@
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "content/shell/shell.h"
+#include "content/shell/shell_content_browser_client.h"
+#include "content/shell/shell_network_delegate.h"
#include "content/test/content_browser_test.h"
#include "content/test/content_browser_test_utils.h"
#include "content/test/net/url_request_failed_job.h"
@@ -426,4 +429,39 @@ IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest,
NavigateToURL(shell(), broken_url);
}
+namespace {
+
+scoped_ptr<net::test_server::HttpResponse> HandleRedirectRequest(
+ const std::string& request_path,
+ const net::test_server::HttpRequest& request) {
+ if (!StartsWithASCII(request.relative_url, request_path, true))
+ return scoped_ptr<net::test_server::HttpResponse>();
+
+ scoped_ptr<net::test_server::BasicHttpResponse> http_response(
+ new net::test_server::BasicHttpResponse);
+ http_response->set_code(net::HTTP_FOUND);
+ http_response->AddCustomHeader(
+ "Location", request.relative_url.substr(request_path.length()));
+ return http_response.PassAs<net::test_server::HttpResponse>();
+}
+
+} // namespace
+
+// Test that we update the cookie policy URLs correctly when transferring
+// navigations.
+IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, CookiePolicy) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+ embedded_test_server()->RegisterRequestHandler(
+ base::Bind(&HandleRedirectRequest, "/redirect?"));
+
+ std::string set_cookie_url(base::StringPrintf(
+ "http://localhost:%d/set_cookie.html", embedded_test_server()->port()));
+ GURL url(embedded_test_server()->GetURL("/redirect?" + set_cookie_url));
+
+ ShellContentBrowserClient::SetSwapProcessesForRedirect(true);
+ ShellNetworkDelegate::SetAcceptAllCookies(false);
+
+ CheckTitleTest(url, "cookie set");
+}
+
} // namespace content
« no previous file with comments | « no previous file | content/browser/loader/resource_dispatcher_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698