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