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