| 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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 541 |
| 542 bool used_ = false; | 542 bool used_ = false; |
| 543 base::RunLoop run_loop_; | 543 base::RunLoop run_loop_; |
| 544 net::HttpRequestHeaders request_headers_; | 544 net::HttpRequestHeaders request_headers_; |
| 545 TestDownloadRequestHandler::OnStartResponseCallback response_callback_; | 545 TestDownloadRequestHandler::OnStartResponseCallback response_callback_; |
| 546 }; | 546 }; |
| 547 | 547 |
| 548 class DownloadContentTest : public ContentBrowserTest { | 548 class DownloadContentTest : public ContentBrowserTest { |
| 549 protected: | 549 protected: |
| 550 void SetUpOnMainThread() override { | 550 void SetUpOnMainThread() override { |
| 551 // Enable downloads resumption. | |
| 552 base::FeatureList::ClearInstanceForTesting(); | |
| 553 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); | |
| 554 feature_list->InitializeFromCommandLine(features::kDownloadResumption.name, | |
| 555 std::string()); | |
| 556 base::FeatureList::SetInstance(std::move(feature_list)); | |
| 557 | |
| 558 ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir()); | 551 ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir()); |
| 559 | 552 |
| 560 test_delegate_.reset(new TestShellDownloadManagerDelegate()); | 553 test_delegate_.reset(new TestShellDownloadManagerDelegate()); |
| 561 test_delegate_->SetDownloadBehaviorForTesting(downloads_directory_.path()); | 554 test_delegate_->SetDownloadBehaviorForTesting(downloads_directory_.path()); |
| 562 DownloadManager* manager = DownloadManagerForShell(shell()); | 555 DownloadManager* manager = DownloadManagerForShell(shell()); |
| 563 manager->GetDelegate()->Shutdown(); | 556 manager->GetDelegate()->Shutdown(); |
| 564 manager->SetDelegate(test_delegate_.get()); | 557 manager->SetDelegate(test_delegate_.get()); |
| 565 test_delegate_->SetDownloadManager(manager); | 558 test_delegate_->SetDownloadManager(manager); |
| 566 | 559 |
| 567 BrowserThread::PostTask( | 560 BrowserThread::PostTask( |
| (...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2473 | 2466 |
| 2474 std::vector<DownloadItem*> downloads; | 2467 std::vector<DownloadItem*> downloads; |
| 2475 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); | 2468 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); |
| 2476 ASSERT_EQ(1u, downloads.size()); | 2469 ASSERT_EQ(1u, downloads.size()); |
| 2477 | 2470 |
| 2478 EXPECT_EQ(FILE_PATH_LITERAL("Jumboshrimp.txt"), | 2471 EXPECT_EQ(FILE_PATH_LITERAL("Jumboshrimp.txt"), |
| 2479 downloads[0]->GetTargetFilePath().BaseName().value()); | 2472 downloads[0]->GetTargetFilePath().BaseName().value()); |
| 2480 } | 2473 } |
| 2481 | 2474 |
| 2482 } // namespace content | 2475 } // namespace content |
| OLD | NEW |