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

Unified Diff: content/browser/download/download_browsertest.cc

Issue 14955002: [Resumption 6/11] Add a RESUMING_INTERNAL state to DownloadItem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/download/download_item_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_browsertest.cc
diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc
index 9d1a3c6024970e4aabe57f8fff879f4d23a340d7..f535d1846af250bcfe3462f9f577b886612ec8c7 100644
--- a/content/browser/download/download_browsertest.cc
+++ b/content/browser/download/download_browsertest.cc
@@ -1378,4 +1378,42 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, ResumeWithFileFinalRenameError) {
EXPECT_EQ(download->GetState(), DownloadItem::COMPLETE);
}
+IN_PROC_BROWSER_TEST_F(DownloadContentTest, RemoveResumingDownload) {
+ SetupEnsureNoPendingDownloads();
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableDownloadResumption);
+ ASSERT_TRUE(test_server()->Start());
+
+ GURL url = test_server()->GetURL(
+ base::StringPrintf("rangereset?size=%d&rst_boundary=%d",
+ GetSafeBufferChunk() * 3, GetSafeBufferChunk()));
+
+ MockDownloadManagerObserver dm_observer(DownloadManagerForShell(shell()));
+ EXPECT_CALL(dm_observer, OnDownloadCreated(_,_)).Times(1);
+
+ DownloadItem* download(StartDownloadAndReturnItem(url));
+ WaitForData(download, GetSafeBufferChunk());
+ ::testing::Mock::VerifyAndClearExpectations(&dm_observer);
+
+ // Tell the server to send the RST and confirm the interrupt happens.
+ ReleaseRSTAndConfirmInterruptForResume(download);
+ ConfirmFileStatusForResume(
+ download, true, GetSafeBufferChunk(), GetSafeBufferChunk() * 3,
+ base::FilePath(FILE_PATH_LITERAL("rangereset.crdownload")));
+
+ // Resume and remove download. We expect only a single OnDownloadCreated()
+ // call, and that's for the second download created below.
+ EXPECT_CALL(dm_observer, OnDownloadCreated(_,_)).Times(1);
+ download->Resume();
+ download->Remove();
+
+ // Start the second download and wait until it's done.
+ base::FilePath file(FILE_PATH_LITERAL("download-test.lib"));
+ GURL url2(URLRequestMockHTTPJob::GetMockUrl(file));
+ // Download the file and wait.
+ DownloadAndWait(shell(), url2, DownloadItem::COMPLETE);
+
+ EXPECT_TRUE(EnsureNoPendingDownloads());
+}
+
} // namespace content
« no previous file with comments | « no previous file | content/browser/download/download_item_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698