Index: content/browser/download/download_browsertest.cc |
diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc |
index 1bbef542d02741dcf5dfde593a91ff31cda2768c..a48492e1912f9816f66cb266aecf804553d261b0 100644 |
--- a/content/browser/download/download_browsertest.cc |
+++ b/content/browser/download/download_browsertest.cc |
@@ -103,12 +103,13 @@ static DownloadManagerImpl* DownloadManagerForShell(Shell* shell) { |
class DownloadFileWithDelay : public DownloadFileImpl { |
public: |
DownloadFileWithDelay( |
- scoped_ptr<DownloadSaveInfo> save_info, |
+ const DownloadSaveInfo& save_info, |
const base::FilePath& default_download_directory, |
const GURL& url, |
const GURL& referrer_url, |
bool calculate_hash, |
- scoped_ptr<ByteStreamReader> stream, |
+ scoped_ptr<net::FileStream> file_stream, |
+ scoped_ptr<ByteStreamReader> byte_stream, |
const net::BoundNetLog& bound_net_log, |
scoped_ptr<PowerSaveBlocker> power_save_blocker, |
base::WeakPtr<DownloadDestinationObserver> observer, |
@@ -151,12 +152,13 @@ class DownloadFileWithDelayFactory : public DownloadFileFactory { |
// DownloadFileFactory interface. |
virtual DownloadFile* CreateFile( |
- scoped_ptr<DownloadSaveInfo> save_info, |
+ const DownloadSaveInfo& save_info, |
const base::FilePath& default_download_directory, |
const GURL& url, |
const GURL& referrer_url, |
bool calculate_hash, |
- scoped_ptr<ByteStreamReader> stream, |
+ scoped_ptr<net::FileStream> file_stream, |
+ scoped_ptr<ByteStreamReader> byte_stream, |
const net::BoundNetLog& bound_net_log, |
base::WeakPtr<DownloadDestinationObserver> observer) OVERRIDE; |
@@ -175,19 +177,20 @@ class DownloadFileWithDelayFactory : public DownloadFileFactory { |
}; |
DownloadFileWithDelay::DownloadFileWithDelay( |
- scoped_ptr<DownloadSaveInfo> save_info, |
+ const DownloadSaveInfo& save_info, |
const base::FilePath& default_download_directory, |
const GURL& url, |
const GURL& referrer_url, |
bool calculate_hash, |
- scoped_ptr<ByteStreamReader> stream, |
+ scoped_ptr<net::FileStream> file_stream, |
+ scoped_ptr<ByteStreamReader> byte_stream, |
const net::BoundNetLog& bound_net_log, |
scoped_ptr<PowerSaveBlocker> power_save_blocker, |
base::WeakPtr<DownloadDestinationObserver> observer, |
base::WeakPtr<DownloadFileWithDelayFactory> owner) |
: DownloadFileImpl( |
- save_info.Pass(), default_download_directory, url, referrer_url, |
- calculate_hash, stream.Pass(), bound_net_log, |
+ save_info, default_download_directory, url, referrer_url, |
+ calculate_hash, file_stream.Pass(), byte_stream.Pass(), bound_net_log, |
power_save_blocker.Pass(), observer), |
owner_(owner) {} |
@@ -228,12 +231,13 @@ DownloadFileWithDelayFactory::DownloadFileWithDelayFactory() |
DownloadFileWithDelayFactory::~DownloadFileWithDelayFactory() {} |
DownloadFile* DownloadFileWithDelayFactory::CreateFile( |
- scoped_ptr<DownloadSaveInfo> save_info, |
+ const DownloadSaveInfo& save_info, |
const base::FilePath& default_download_directory, |
const GURL& url, |
const GURL& referrer_url, |
bool calculate_hash, |
- scoped_ptr<ByteStreamReader> stream, |
+ scoped_ptr<net::FileStream> file_stream, |
+ scoped_ptr<ByteStreamReader> byte_stream, |
const net::BoundNetLog& bound_net_log, |
base::WeakPtr<DownloadDestinationObserver> observer) { |
scoped_ptr<PowerSaveBlocker> psb( |
@@ -241,8 +245,8 @@ DownloadFile* DownloadFileWithDelayFactory::CreateFile( |
PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
"Download in progress")); |
return new DownloadFileWithDelay( |
- save_info.Pass(), default_download_directory, url, referrer_url, |
- calculate_hash, stream.Pass(), bound_net_log, |
+ save_info, default_download_directory, url, referrer_url, |
+ calculate_hash, file_stream.Pass(), byte_stream.Pass(), bound_net_log, |
psb.Pass(), observer, weak_ptr_factory_.GetWeakPtr()); |
} |
@@ -272,18 +276,19 @@ void DownloadFileWithDelayFactory::WaitForSomeCallback() { |
class CountingDownloadFile : public DownloadFileImpl { |
public: |
CountingDownloadFile( |
- scoped_ptr<DownloadSaveInfo> save_info, |
+ const DownloadSaveInfo& save_info, |
const base::FilePath& default_downloads_directory, |
const GURL& url, |
const GURL& referrer_url, |
bool calculate_hash, |
- scoped_ptr<ByteStreamReader> stream, |
+ scoped_ptr<net::FileStream> file_stream, |
+ scoped_ptr<ByteStreamReader> byte_stream, |
const net::BoundNetLog& bound_net_log, |
scoped_ptr<PowerSaveBlocker> power_save_blocker, |
base::WeakPtr<DownloadDestinationObserver> observer) |
- : DownloadFileImpl(save_info.Pass(), default_downloads_directory, |
+ : DownloadFileImpl(save_info, default_downloads_directory, |
url, referrer_url, calculate_hash, |
- stream.Pass(), bound_net_log, |
+ file_stream.Pass(), byte_stream.Pass(), bound_net_log, |
power_save_blocker.Pass(), observer) {} |
virtual ~CountingDownloadFile() { |
@@ -329,21 +334,22 @@ class CountingDownloadFileFactory : public DownloadFileFactory { |
// DownloadFileFactory interface. |
virtual DownloadFile* CreateFile( |
- scoped_ptr<DownloadSaveInfo> save_info, |
- const base::FilePath& default_downloads_directory, |
- const GURL& url, |
- const GURL& referrer_url, |
- bool calculate_hash, |
- scoped_ptr<ByteStreamReader> stream, |
- const net::BoundNetLog& bound_net_log, |
- base::WeakPtr<DownloadDestinationObserver> observer) OVERRIDE { |
+ const DownloadSaveInfo& save_info, |
+ const base::FilePath& default_downloads_directory, |
+ const GURL& url, |
+ const GURL& referrer_url, |
+ bool calculate_hash, |
+ scoped_ptr<net::FileStream> file_stream, |
+ scoped_ptr<ByteStreamReader> byte_stream, |
+ const net::BoundNetLog& bound_net_log, |
+ base::WeakPtr<DownloadDestinationObserver> observer) OVERRIDE { |
scoped_ptr<PowerSaveBlocker> psb( |
PowerSaveBlocker::Create( |
PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
"Download in progress")); |
return new CountingDownloadFile( |
- save_info.Pass(), default_downloads_directory, url, referrer_url, |
- calculate_hash, stream.Pass(), bound_net_log, |
+ save_info, default_downloads_directory, url, referrer_url, |
+ calculate_hash, file_stream.Pass(), byte_stream.Pass(), bound_net_log, |
psb.Pass(), observer); |
} |
}; |
@@ -1170,8 +1176,6 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, |
static const RecordingDownloadObserver::RecordStruct expected_record[] = { |
// Result of RST |
{DownloadItem::INTERRUPTED, GetSafeBufferChunk()}, |
- // Starting continuation |
- {DownloadItem::IN_PROGRESS, GetSafeBufferChunk()}, |
// Server precondition fail. |
{DownloadItem::INTERRUPTED, 0}, |
// Notification of successful restart. |
@@ -1309,7 +1313,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, ResumeWithFileInitError) { |
download->GetLastReason()); |
EXPECT_EQ(0, download->GetReceivedBytes()); |
EXPECT_TRUE(download->GetFullPath().empty()); |
- EXPECT_TRUE(download->GetTargetFilePath().empty()); |
+ EXPECT_FALSE(download->GetTargetFilePath().empty()); |
// We need to make sure that any cross-thread downloads communication has |
// quiesced before clearing and injecting the new errors, as the |