OLD | NEW |
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 // This file contains download browser tests that are known to be runnable | 5 // This file contains download browser tests that are known to be runnable |
6 // in a pure content context. Over time tests should be migrated here. | 6 // in a pure content context. Over time tests should be migrated here. |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <utility> | 10 #include <utility> |
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 | 2230 |
2231 // Check that the cookie policy is correctly updated when downloading a file | 2231 // Check that the cookie policy is correctly updated when downloading a file |
2232 // that redirects cross origin. | 2232 // that redirects cross origin. |
2233 IN_PROC_BROWSER_TEST_F(DownloadContentTest, CookiePolicy) { | 2233 IN_PROC_BROWSER_TEST_F(DownloadContentTest, CookiePolicy) { |
2234 net::EmbeddedTestServer origin_one; | 2234 net::EmbeddedTestServer origin_one; |
2235 net::EmbeddedTestServer origin_two; | 2235 net::EmbeddedTestServer origin_two; |
2236 ASSERT_TRUE(origin_one.Start()); | 2236 ASSERT_TRUE(origin_one.Start()); |
2237 ASSERT_TRUE(origin_two.Start()); | 2237 ASSERT_TRUE(origin_two.Start()); |
2238 | 2238 |
2239 // Block third-party cookies. | 2239 // Block third-party cookies. |
2240 ShellNetworkDelegate::SetAcceptAllCookies(false); | 2240 ShellNetworkDelegate::SetBlockThirdPartyCookies(true); |
2241 | 2241 |
2242 // |url| redirects to a different origin |download| which tries to set a | 2242 // |url| redirects to a different origin |download| which tries to set a |
2243 // cookie. | 2243 // cookie. |
2244 base::StringPairs cookie_header; | 2244 base::StringPairs cookie_header; |
2245 cookie_header.push_back( | 2245 cookie_header.push_back( |
2246 std::make_pair(std::string("Set-Cookie"), std::string("A=B"))); | 2246 std::make_pair(std::string("Set-Cookie"), std::string("A=B"))); |
2247 origin_one.RegisterRequestHandler(CreateBasicResponseHandler( | 2247 origin_one.RegisterRequestHandler(CreateBasicResponseHandler( |
2248 "/foo", cookie_header, "application/octet-stream", "abcd")); | 2248 "/foo", cookie_header, "application/octet-stream", "abcd")); |
2249 origin_two.RegisterRequestHandler( | 2249 origin_two.RegisterRequestHandler( |
2250 CreateRedirectHandler("/bar", origin_one.GetURL("/foo"))); | 2250 CreateRedirectHandler("/bar", origin_one.GetURL("/foo"))); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2472 | 2472 |
2473 std::vector<DownloadItem*> downloads; | 2473 std::vector<DownloadItem*> downloads; |
2474 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); | 2474 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); |
2475 ASSERT_EQ(1u, downloads.size()); | 2475 ASSERT_EQ(1u, downloads.size()); |
2476 | 2476 |
2477 EXPECT_EQ(FILE_PATH_LITERAL("Jumboshrimp.txt"), | 2477 EXPECT_EQ(FILE_PATH_LITERAL("Jumboshrimp.txt"), |
2478 downloads[0]->GetTargetFilePath().BaseName().value()); | 2478 downloads[0]->GetTargetFilePath().BaseName().value()); |
2479 } | 2479 } |
2480 | 2480 |
2481 } // namespace content | 2481 } // namespace content |
OLD | NEW |