| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 252 |
| 253 DownloadFile* DownloadFileWithDelayFactory::CreateFile( | 253 DownloadFile* DownloadFileWithDelayFactory::CreateFile( |
| 254 std::unique_ptr<DownloadSaveInfo> save_info, | 254 std::unique_ptr<DownloadSaveInfo> save_info, |
| 255 const base::FilePath& default_download_directory, | 255 const base::FilePath& default_download_directory, |
| 256 std::unique_ptr<ByteStreamReader> stream, | 256 std::unique_ptr<ByteStreamReader> stream, |
| 257 const net::BoundNetLog& bound_net_log, | 257 const net::BoundNetLog& bound_net_log, |
| 258 base::WeakPtr<DownloadDestinationObserver> observer) { | 258 base::WeakPtr<DownloadDestinationObserver> observer) { |
| 259 std::unique_ptr<device::PowerSaveBlocker> psb(new device::PowerSaveBlocker( | 259 std::unique_ptr<device::PowerSaveBlocker> psb(new device::PowerSaveBlocker( |
| 260 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 260 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
| 261 device::PowerSaveBlocker::kReasonOther, "Download in progress", | 261 device::PowerSaveBlocker::kReasonOther, "Download in progress", |
| 262 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 262 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
| 263 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); | 263 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); |
| 264 return new DownloadFileWithDelay(std::move(save_info), | 264 return new DownloadFileWithDelay(std::move(save_info), |
| 265 default_download_directory, | 265 default_download_directory, |
| 266 std::move(stream), | 266 std::move(stream), |
| 267 bound_net_log, | 267 bound_net_log, |
| 268 std::move(psb), | 268 std::move(psb), |
| 269 observer, | 269 observer, |
| 270 weak_ptr_factory_.GetWeakPtr()); | 270 weak_ptr_factory_.GetWeakPtr()); |
| 271 } | 271 } |
| 272 | 272 |
| 273 void DownloadFileWithDelayFactory::AddRenameCallback(base::Closure callback) { | 273 void DownloadFileWithDelayFactory::AddRenameCallback(base::Closure callback) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 // DownloadFileFactory interface. | 351 // DownloadFileFactory interface. |
| 352 DownloadFile* CreateFile( | 352 DownloadFile* CreateFile( |
| 353 std::unique_ptr<DownloadSaveInfo> save_info, | 353 std::unique_ptr<DownloadSaveInfo> save_info, |
| 354 const base::FilePath& default_downloads_directory, | 354 const base::FilePath& default_downloads_directory, |
| 355 std::unique_ptr<ByteStreamReader> stream, | 355 std::unique_ptr<ByteStreamReader> stream, |
| 356 const net::BoundNetLog& bound_net_log, | 356 const net::BoundNetLog& bound_net_log, |
| 357 base::WeakPtr<DownloadDestinationObserver> observer) override { | 357 base::WeakPtr<DownloadDestinationObserver> observer) override { |
| 358 std::unique_ptr<device::PowerSaveBlocker> psb(new device::PowerSaveBlocker( | 358 std::unique_ptr<device::PowerSaveBlocker> psb(new device::PowerSaveBlocker( |
| 359 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 359 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
| 360 device::PowerSaveBlocker::kReasonOther, "Download in progress", | 360 device::PowerSaveBlocker::kReasonOther, "Download in progress", |
| 361 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 361 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
| 362 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE))); | 362 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE))); |
| 363 return new CountingDownloadFile(std::move(save_info), | 363 return new CountingDownloadFile(std::move(save_info), |
| 364 default_downloads_directory, | 364 default_downloads_directory, |
| 365 std::move(stream), | 365 std::move(stream), |
| 366 bound_net_log, | 366 bound_net_log, |
| 367 std::move(psb), | 367 std::move(psb), |
| 368 observer); | 368 observer); |
| 369 } | 369 } |
| 370 }; | 370 }; |
| 371 | 371 |
| 372 class TestShellDownloadManagerDelegate : public ShellDownloadManagerDelegate { | 372 class TestShellDownloadManagerDelegate : public ShellDownloadManagerDelegate { |
| (...skipping 2100 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 |