| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 const base::FilePath& default_download_directory, | 203 const base::FilePath& default_download_directory, |
| 204 std::unique_ptr<ByteStreamReader> stream, | 204 std::unique_ptr<ByteStreamReader> stream, |
| 205 const net::NetLogWithSource& net_log, | 205 const net::NetLogWithSource& net_log, |
| 206 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker, | 206 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker, |
| 207 base::WeakPtr<DownloadDestinationObserver> observer, | 207 base::WeakPtr<DownloadDestinationObserver> observer, |
| 208 base::WeakPtr<DownloadFileWithDelayFactory> owner) | 208 base::WeakPtr<DownloadFileWithDelayFactory> owner) |
| 209 : DownloadFileImpl(std::move(save_info), | 209 : DownloadFileImpl(std::move(save_info), |
| 210 default_download_directory, | 210 default_download_directory, |
| 211 std::move(stream), | 211 std::move(stream), |
| 212 net_log, | 212 net_log, |
| 213 false, |
| 213 observer), | 214 observer), |
| 214 owner_(owner) {} | 215 owner_(owner) {} |
| 215 | 216 |
| 216 DownloadFileWithDelay::~DownloadFileWithDelay() {} | 217 DownloadFileWithDelay::~DownloadFileWithDelay() {} |
| 217 | 218 |
| 218 void DownloadFileWithDelay::RenameAndUniquify( | 219 void DownloadFileWithDelay::RenameAndUniquify( |
| 219 const base::FilePath& full_path, | 220 const base::FilePath& full_path, |
| 220 const RenameCompletionCallback& callback) { | 221 const RenameCompletionCallback& callback) { |
| 221 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 222 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 222 DownloadFileImpl::RenameAndUniquify( | 223 DownloadFileImpl::RenameAndUniquify( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 std::unique_ptr<DownloadSaveInfo> save_info, | 308 std::unique_ptr<DownloadSaveInfo> save_info, |
| 308 const base::FilePath& default_downloads_directory, | 309 const base::FilePath& default_downloads_directory, |
| 309 std::unique_ptr<ByteStreamReader> stream, | 310 std::unique_ptr<ByteStreamReader> stream, |
| 310 const net::NetLogWithSource& net_log, | 311 const net::NetLogWithSource& net_log, |
| 311 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker, | 312 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker, |
| 312 base::WeakPtr<DownloadDestinationObserver> observer) | 313 base::WeakPtr<DownloadDestinationObserver> observer) |
| 313 : DownloadFileImpl(std::move(save_info), | 314 : DownloadFileImpl(std::move(save_info), |
| 314 default_downloads_directory, | 315 default_downloads_directory, |
| 315 std::move(stream), | 316 std::move(stream), |
| 316 net_log, | 317 net_log, |
| 318 false, |
| 317 observer) {} | 319 observer) {} |
| 318 | 320 |
| 319 ~CountingDownloadFile() override { | 321 ~CountingDownloadFile() override { |
| 320 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 322 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 321 active_files_--; | 323 active_files_--; |
| 322 } | 324 } |
| 323 | 325 |
| 324 void Initialize(const InitializeCallback& callback) override { | 326 void Initialize(const InitializeCallback& callback) override { |
| 325 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 327 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 326 active_files_++; | 328 active_files_++; |
| (...skipping 2317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2644 GURL document_url = | 2646 GURL document_url = |
| 2645 origin_two.GetURL("/iframe-host.html?target=" + frame_url.spec()); | 2647 origin_two.GetURL("/iframe-host.html?target=" + frame_url.spec()); |
| 2646 DownloadItem* download = StartDownloadAndReturnItem(shell(), document_url); | 2648 DownloadItem* download = StartDownloadAndReturnItem(shell(), document_url); |
| 2647 WaitForCompletion(download); | 2649 WaitForCompletion(download); |
| 2648 | 2650 |
| 2649 EXPECT_STREQ(FILE_PATH_LITERAL("download-test.lib"), | 2651 EXPECT_STREQ(FILE_PATH_LITERAL("download-test.lib"), |
| 2650 download->GetTargetFilePath().BaseName().value().c_str()); | 2652 download->GetTargetFilePath().BaseName().value().c_str()); |
| 2651 } | 2653 } |
| 2652 | 2654 |
| 2653 } // namespace content | 2655 } // namespace content |
| OLD | NEW |