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

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

Issue 11784016: chromeos: Block system suspend while uploading files to Drive (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/download/download_file_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "content/browser/download/download_file_factory.h" 12 #include "content/browser/download/download_file_factory.h"
13 #include "content/browser/download/download_file_impl.h" 13 #include "content/browser/download/download_file_impl.h"
14 #include "content/browser/download/download_item_impl.h" 14 #include "content/browser/download/download_item_impl.h"
15 #include "content/browser/download/download_manager_impl.h" 15 #include "content/browser/download/download_manager_impl.h"
16 #include "content/browser/power_save_blocker.h"
17 #include "content/browser/web_contents/web_contents_impl.h" 16 #include "content/browser/web_contents/web_contents_impl.h"
17 #include "content/public/browser/power_save_blocker.h"
18 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
19 #include "content/public/test/download_test_observer.h" 19 #include "content/public/test/download_test_observer.h"
20 #include "content/public/test/test_utils.h" 20 #include "content/public/test/test_utils.h"
21 #include "content/shell/shell.h" 21 #include "content/shell/shell.h"
22 #include "content/shell/shell_browser_context.h" 22 #include "content/shell/shell_browser_context.h"
23 #include "content/shell/shell_download_manager_delegate.h" 23 #include "content/shell/shell_download_manager_delegate.h"
24 #include "content/test/content_browser_test.h" 24 #include "content/test/content_browser_test.h"
25 #include "content/test/content_browser_test_utils.h" 25 #include "content/test/content_browser_test_utils.h"
26 #include "content/test/net/url_request_mock_http_job.h" 26 #include "content/test/net/url_request_mock_http_job.h"
27 #include "content/test/net/url_request_slow_download_job.h" 27 #include "content/test/net/url_request_slow_download_job.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 DownloadFile* DownloadFileWithDelayFactory::CreateFile( 200 DownloadFile* DownloadFileWithDelayFactory::CreateFile(
201 scoped_ptr<DownloadSaveInfo> save_info, 201 scoped_ptr<DownloadSaveInfo> save_info,
202 const FilePath& default_download_directory, 202 const FilePath& default_download_directory,
203 const GURL& url, 203 const GURL& url,
204 const GURL& referrer_url, 204 const GURL& referrer_url,
205 bool calculate_hash, 205 bool calculate_hash,
206 scoped_ptr<ByteStreamReader> stream, 206 scoped_ptr<ByteStreamReader> stream,
207 const net::BoundNetLog& bound_net_log, 207 const net::BoundNetLog& bound_net_log,
208 base::WeakPtr<DownloadDestinationObserver> observer) { 208 base::WeakPtr<DownloadDestinationObserver> observer) {
209 scoped_ptr<PowerSaveBlocker> psb( 209 scoped_ptr<PowerSaveBlocker> psb(
210 new PowerSaveBlocker( 210 PowerSaveBlocker::Create(
211 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 211 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
212 "Download in progress")); 212 "Download in progress"));
213 return new DownloadFileWithDelay( 213 return new DownloadFileWithDelay(
214 save_info.Pass(), default_download_directory, url, referrer_url, 214 save_info.Pass(), default_download_directory, url, referrer_url,
215 calculate_hash, stream.Pass(), bound_net_log, 215 calculate_hash, stream.Pass(), bound_net_log,
216 psb.Pass(), observer, weak_ptr_factory_.GetWeakPtr()); 216 psb.Pass(), observer, weak_ptr_factory_.GetWeakPtr());
217 } 217 }
218 218
219 void DownloadFileWithDelayFactory::AddRenameCallback(base::Closure callback) { 219 void DownloadFileWithDelayFactory::AddRenameCallback(base::Closure callback) {
220 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 220 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 virtual DownloadFile* CreateFile( 299 virtual DownloadFile* CreateFile(
300 scoped_ptr<DownloadSaveInfo> save_info, 300 scoped_ptr<DownloadSaveInfo> save_info,
301 const FilePath& default_downloads_directory, 301 const FilePath& default_downloads_directory,
302 const GURL& url, 302 const GURL& url,
303 const GURL& referrer_url, 303 const GURL& referrer_url,
304 bool calculate_hash, 304 bool calculate_hash,
305 scoped_ptr<ByteStreamReader> stream, 305 scoped_ptr<ByteStreamReader> stream,
306 const net::BoundNetLog& bound_net_log, 306 const net::BoundNetLog& bound_net_log,
307 base::WeakPtr<DownloadDestinationObserver> observer) OVERRIDE { 307 base::WeakPtr<DownloadDestinationObserver> observer) OVERRIDE {
308 scoped_ptr<PowerSaveBlocker> psb( 308 scoped_ptr<PowerSaveBlocker> psb(
309 new PowerSaveBlocker( 309 PowerSaveBlocker::Create(
310 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 310 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
311 "Download in progress")); 311 "Download in progress"));
312 return new CountingDownloadFile( 312 return new CountingDownloadFile(
313 save_info.Pass(), default_downloads_directory, url, referrer_url, 313 save_info.Pass(), default_downloads_directory, url, referrer_url,
314 calculate_hash, stream.Pass(), bound_net_log, 314 calculate_hash, stream.Pass(), bound_net_log,
315 psb.Pass(), observer); 315 psb.Pass(), observer);
316 } 316 }
317 }; 317 };
318 318
319 class TestShellDownloadManagerDelegate : public ShellDownloadManagerDelegate { 319 class TestShellDownloadManagerDelegate : public ShellDownloadManagerDelegate {
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 ASSERT_TRUE(file_util::ReadFileToString( 835 ASSERT_TRUE(file_util::ReadFileToString(
836 download->GetFullPath(), &file_contents)); 836 download->GetFullPath(), &file_contents));
837 EXPECT_EQ(8000u, file_contents.size()); 837 EXPECT_EQ(8000u, file_contents.size());
838 // In conditional to avoid spamming the console with two 800 char strings. 838 // In conditional to avoid spamming the console with two 800 char strings.
839 if (expected_contents != file_contents) 839 if (expected_contents != file_contents)
840 EXPECT_TRUE(false) << "File contents do not have expected value."; 840 EXPECT_TRUE(false) << "File contents do not have expected value.";
841 } 841 }
842 } 842 }
843 843
844 } // namespace content 844 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/download_file_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698