Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1316)

Side by Side Diff: content/browser/download/download_browsertest.cc

Issue 2012853003: Reland of Pass SequencedTaskRunner to PowerSaveBlocker for ui/file ops (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SingleThreadTaskRunner for _x11 Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 14 matching lines...) Expand all
25 #include "build/build_config.h" 25 #include "build/build_config.h"
26 #include "content/browser/byte_stream.h" 26 #include "content/browser/byte_stream.h"
27 #include "content/browser/download/download_file_factory.h" 27 #include "content/browser/download/download_file_factory.h"
28 #include "content/browser/download/download_file_impl.h" 28 #include "content/browser/download/download_file_impl.h"
29 #include "content/browser/download/download_item_impl.h" 29 #include "content/browser/download/download_item_impl.h"
30 #include "content/browser/download/download_manager_impl.h" 30 #include "content/browser/download/download_manager_impl.h"
31 #include "content/browser/download/download_resource_handler.h" 31 #include "content/browser/download/download_resource_handler.h"
32 #include "content/browser/loader/resource_dispatcher_host_impl.h" 32 #include "content/browser/loader/resource_dispatcher_host_impl.h"
33 #include "content/browser/web_contents/web_contents_impl.h" 33 #include "content/browser/web_contents/web_contents_impl.h"
34 #include "content/public/browser/download_danger_type.h" 34 #include "content/public/browser/download_danger_type.h"
35 #include "content/public/browser/power_save_blocker.h" 35 #include "content/public/browser/power_save_blocker_factory.h"
36 #include "content/public/browser/resource_dispatcher_host_delegate.h" 36 #include "content/public/browser/resource_dispatcher_host_delegate.h"
37 #include "content/public/browser/resource_throttle.h" 37 #include "content/public/browser/resource_throttle.h"
38 #include "content/public/common/content_features.h" 38 #include "content/public/common/content_features.h"
39 #include "content/public/common/webplugininfo.h" 39 #include "content/public/common/webplugininfo.h"
40 #include "content/public/test/browser_test_utils.h" 40 #include "content/public/test/browser_test_utils.h"
41 #include "content/public/test/content_browser_test.h" 41 #include "content/public/test/content_browser_test.h"
42 #include "content/public/test/content_browser_test_utils.h" 42 #include "content/public/test/content_browser_test_utils.h"
43 #include "content/public/test/download_test_observer.h" 43 #include "content/public/test/download_test_observer.h"
44 #include "content/public/test/test_download_request_handler.h" 44 #include "content/public/test/test_download_request_handler.h"
45 #include "content/public/test/test_file_error_injector.h" 45 #include "content/public/test/test_file_error_injector.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 weak_ptr_factory_(this) {} 247 weak_ptr_factory_(this) {}
248 248
249 DownloadFileWithDelayFactory::~DownloadFileWithDelayFactory() {} 249 DownloadFileWithDelayFactory::~DownloadFileWithDelayFactory() {}
250 250
251 DownloadFile* DownloadFileWithDelayFactory::CreateFile( 251 DownloadFile* DownloadFileWithDelayFactory::CreateFile(
252 std::unique_ptr<DownloadSaveInfo> save_info, 252 std::unique_ptr<DownloadSaveInfo> save_info,
253 const base::FilePath& default_download_directory, 253 const base::FilePath& default_download_directory,
254 std::unique_ptr<ByteStreamReader> stream, 254 std::unique_ptr<ByteStreamReader> stream,
255 const net::BoundNetLog& bound_net_log, 255 const net::BoundNetLog& bound_net_log,
256 base::WeakPtr<DownloadDestinationObserver> observer) { 256 base::WeakPtr<DownloadDestinationObserver> observer) {
257 std::unique_ptr<PowerSaveBlocker> psb(PowerSaveBlocker::Create( 257 std::unique_ptr<PowerSaveBlocker> psb(CreatePowerSaveBlocker(
258 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 258 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
259 PowerSaveBlocker::kReasonOther, "Download in progress")); 259 PowerSaveBlocker::kReasonOther, "Download in progress"));
260 return new DownloadFileWithDelay(std::move(save_info), 260 return new DownloadFileWithDelay(std::move(save_info),
261 default_download_directory, 261 default_download_directory,
262 std::move(stream), 262 std::move(stream),
263 bound_net_log, 263 bound_net_log,
264 std::move(psb), 264 std::move(psb),
265 observer, 265 observer,
266 weak_ptr_factory_.GetWeakPtr()); 266 weak_ptr_factory_.GetWeakPtr());
267 } 267 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 CountingDownloadFileFactory() {} 343 CountingDownloadFileFactory() {}
344 ~CountingDownloadFileFactory() override {} 344 ~CountingDownloadFileFactory() override {}
345 345
346 // DownloadFileFactory interface. 346 // DownloadFileFactory interface.
347 DownloadFile* CreateFile( 347 DownloadFile* CreateFile(
348 std::unique_ptr<DownloadSaveInfo> save_info, 348 std::unique_ptr<DownloadSaveInfo> save_info,
349 const base::FilePath& default_downloads_directory, 349 const base::FilePath& default_downloads_directory,
350 std::unique_ptr<ByteStreamReader> stream, 350 std::unique_ptr<ByteStreamReader> stream,
351 const net::BoundNetLog& bound_net_log, 351 const net::BoundNetLog& bound_net_log,
352 base::WeakPtr<DownloadDestinationObserver> observer) override { 352 base::WeakPtr<DownloadDestinationObserver> observer) override {
353 std::unique_ptr<PowerSaveBlocker> psb(PowerSaveBlocker::Create( 353 std::unique_ptr<PowerSaveBlocker> psb(CreatePowerSaveBlocker(
354 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 354 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
355 PowerSaveBlocker::kReasonOther, "Download in progress")); 355 PowerSaveBlocker::kReasonOther, "Download in progress"));
356 return new CountingDownloadFile(std::move(save_info), 356 return new CountingDownloadFile(std::move(save_info),
357 default_downloads_directory, 357 default_downloads_directory,
358 std::move(stream), 358 std::move(stream),
359 bound_net_log, 359 bound_net_log,
360 std::move(psb), 360 std::move(psb),
361 observer); 361 observer);
362 } 362 }
363 }; 363 };
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « content/browser/devtools/render_frame_devtools_agent_host.cc ('k') | content/browser/download/download_request_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698