| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 observer) {} | 317 observer) {} |
| 318 | 318 |
| 319 ~CountingDownloadFile() override { | 319 ~CountingDownloadFile() override { |
| 320 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 320 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 321 active_files_--; | 321 active_files_--; |
| 322 } | 322 } |
| 323 | 323 |
| 324 void Initialize( | 324 void Initialize( |
| 325 const InitializeCallback& callback, | 325 const InitializeCallback& callback, |
| 326 const CancelRequestCallback& cancel_request_callback, | 326 const CancelRequestCallback& cancel_request_callback, |
| 327 const DownloadItem::ReceivedSlices& received_slices) override { | 327 const DownloadItem::ReceivedSlices& received_slices, |
| 328 bool is_parallelizable) override { |
| 328 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 329 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 329 active_files_++; | 330 active_files_++; |
| 330 DownloadFileImpl::Initialize(callback, cancel_request_callback, | 331 DownloadFileImpl::Initialize(callback, cancel_request_callback, |
| 331 received_slices); | 332 received_slices, is_parallelizable); |
| 332 } | 333 } |
| 333 | 334 |
| 334 static void GetNumberActiveFiles(int* result) { | 335 static void GetNumberActiveFiles(int* result) { |
| 335 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 336 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 336 *result = active_files_; | 337 *result = active_files_; |
| 337 } | 338 } |
| 338 | 339 |
| 339 // Can be called on any thread, and will block (running message loop) | 340 // Can be called on any thread, and will block (running message loop) |
| 340 // until data is returned. | 341 // until data is returned. |
| 341 static int GetNumberActiveFilesFromFileThread() { | 342 static int GetNumberActiveFilesFromFileThread() { |
| (...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2648 GURL document_url = | 2649 GURL document_url = |
| 2649 origin_two.GetURL("/iframe-host.html?target=" + frame_url.spec()); | 2650 origin_two.GetURL("/iframe-host.html?target=" + frame_url.spec()); |
| 2650 DownloadItem* download = StartDownloadAndReturnItem(shell(), document_url); | 2651 DownloadItem* download = StartDownloadAndReturnItem(shell(), document_url); |
| 2651 WaitForCompletion(download); | 2652 WaitForCompletion(download); |
| 2652 | 2653 |
| 2653 EXPECT_STREQ(FILE_PATH_LITERAL("download-test.lib"), | 2654 EXPECT_STREQ(FILE_PATH_LITERAL("download-test.lib"), |
| 2654 download->GetTargetFilePath().BaseName().value().c_str()); | 2655 download->GetTargetFilePath().BaseName().value().c_str()); |
| 2655 } | 2656 } |
| 2656 | 2657 |
| 2657 } // namespace content | 2658 } // namespace content |
| OLD | NEW |