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 2235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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"))); |
2252 | 2252 |
2253 // Download the file. | 2253 // Download the file. |
2254 SetupEnsureNoPendingDownloads(); | 2254 SetupEnsureNoPendingDownloads(); |
2255 std::unique_ptr<DownloadUrlParameters> download_parameters( | 2255 std::unique_ptr<DownloadUrlParameters> download_parameters( |
2256 DownloadUrlParameters::FromWebContents(shell()->web_contents(), | 2256 DownloadUrlParameters::CreateForWebContentsMainFrame( |
2257 origin_two.GetURL("/bar"))); | 2257 shell()->web_contents(), origin_two.GetURL("/bar"))); |
2258 std::unique_ptr<DownloadTestObserver> observer(CreateWaiter(shell(), 1)); | 2258 std::unique_ptr<DownloadTestObserver> observer(CreateWaiter(shell(), 1)); |
2259 DownloadManagerForShell(shell())->DownloadUrl(std::move(download_parameters)); | 2259 DownloadManagerForShell(shell())->DownloadUrl(std::move(download_parameters)); |
2260 observer->WaitForFinished(); | 2260 observer->WaitForFinished(); |
2261 | 2261 |
2262 // Get the important info from other threads and check it. | 2262 // Get the important info from other threads and check it. |
2263 EXPECT_TRUE(EnsureNoPendingDownloads()); | 2263 EXPECT_TRUE(EnsureNoPendingDownloads()); |
2264 | 2264 |
2265 std::vector<DownloadItem*> downloads; | 2265 std::vector<DownloadItem*> downloads; |
2266 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); | 2266 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); |
2267 ASSERT_EQ(1u, downloads.size()); | 2267 ASSERT_EQ(1u, downloads.size()); |
(...skipping 205 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 |