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

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

Issue 2073353002: Merge PowerSaveBlockerImpl and PowerSaveBlocker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-power-factory
Patch Set: android 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 weak_ptr_factory_(this) {} 248 weak_ptr_factory_(this) {}
249 249
250 DownloadFileWithDelayFactory::~DownloadFileWithDelayFactory() {} 250 DownloadFileWithDelayFactory::~DownloadFileWithDelayFactory() {}
251 251
252 DownloadFile* DownloadFileWithDelayFactory::CreateFile( 252 DownloadFile* DownloadFileWithDelayFactory::CreateFile(
253 std::unique_ptr<DownloadSaveInfo> save_info, 253 std::unique_ptr<DownloadSaveInfo> save_info,
254 const base::FilePath& default_download_directory, 254 const base::FilePath& default_download_directory,
255 std::unique_ptr<ByteStreamReader> stream, 255 std::unique_ptr<ByteStreamReader> stream,
256 const net::BoundNetLog& bound_net_log, 256 const net::BoundNetLog& bound_net_log,
257 base::WeakPtr<DownloadDestinationObserver> observer) { 257 base::WeakPtr<DownloadDestinationObserver> observer) {
258 std::unique_ptr<device::PowerSaveBlocker> psb( 258 std::unique_ptr<device::PowerSaveBlocker> psb(new device::PowerSaveBlocker(
259 device::PowerSaveBlocker::CreateWithTaskRunners( 259 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
260 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 260 device::PowerSaveBlocker::kReasonOther, "Download in progress",
261 device::PowerSaveBlocker::kReasonOther, "Download in progress", 261 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
262 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 262 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
263 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
264 return new DownloadFileWithDelay(std::move(save_info), 263 return new DownloadFileWithDelay(std::move(save_info),
265 default_download_directory, 264 default_download_directory,
266 std::move(stream), 265 std::move(stream),
267 bound_net_log, 266 bound_net_log,
268 std::move(psb), 267 std::move(psb),
269 observer, 268 observer,
270 weak_ptr_factory_.GetWeakPtr()); 269 weak_ptr_factory_.GetWeakPtr());
271 } 270 }
272 271
273 void DownloadFileWithDelayFactory::AddRenameCallback(base::Closure callback) { 272 void DownloadFileWithDelayFactory::AddRenameCallback(base::Closure callback) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 CountingDownloadFileFactory() {} 347 CountingDownloadFileFactory() {}
349 ~CountingDownloadFileFactory() override {} 348 ~CountingDownloadFileFactory() override {}
350 349
351 // DownloadFileFactory interface. 350 // DownloadFileFactory interface.
352 DownloadFile* CreateFile( 351 DownloadFile* CreateFile(
353 std::unique_ptr<DownloadSaveInfo> save_info, 352 std::unique_ptr<DownloadSaveInfo> save_info,
354 const base::FilePath& default_downloads_directory, 353 const base::FilePath& default_downloads_directory,
355 std::unique_ptr<ByteStreamReader> stream, 354 std::unique_ptr<ByteStreamReader> stream,
356 const net::BoundNetLog& bound_net_log, 355 const net::BoundNetLog& bound_net_log,
357 base::WeakPtr<DownloadDestinationObserver> observer) override { 356 base::WeakPtr<DownloadDestinationObserver> observer) override {
358 std::unique_ptr<device::PowerSaveBlocker> psb( 357 std::unique_ptr<device::PowerSaveBlocker> psb(new device::PowerSaveBlocker(
359 device::PowerSaveBlocker::CreateWithTaskRunners( 358 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
360 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 359 device::PowerSaveBlocker::kReasonOther, "Download in progress",
361 device::PowerSaveBlocker::kReasonOther, "Download in progress", 360 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
362 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 361 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
363 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
364 return new CountingDownloadFile(std::move(save_info), 362 return new CountingDownloadFile(std::move(save_info),
365 default_downloads_directory, 363 default_downloads_directory,
366 std::move(stream), 364 std::move(stream),
367 bound_net_log, 365 bound_net_log,
368 std::move(psb), 366 std::move(psb),
369 observer); 367 observer);
370 } 368 }
371 }; 369 };
372 370
373 class TestShellDownloadManagerDelegate : public ShellDownloadManagerDelegate { 371 class TestShellDownloadManagerDelegate : public ShellDownloadManagerDelegate {
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2474 2472
2475 std::vector<DownloadItem*> downloads; 2473 std::vector<DownloadItem*> downloads;
2476 DownloadManagerForShell(shell())->GetAllDownloads(&downloads); 2474 DownloadManagerForShell(shell())->GetAllDownloads(&downloads);
2477 ASSERT_EQ(1u, downloads.size()); 2475 ASSERT_EQ(1u, downloads.size());
2478 2476
2479 EXPECT_EQ(FILE_PATH_LITERAL("Jumboshrimp.txt"), 2477 EXPECT_EQ(FILE_PATH_LITERAL("Jumboshrimp.txt"),
2480 downloads[0]->GetTargetFilePath().BaseName().value()); 2478 downloads[0]->GetTargetFilePath().BaseName().value());
2481 } 2479 }
2482 2480
2483 } // namespace content 2481 } // 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