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

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

Issue 2812263004: Properly handle the case when a parallel download becomes non-parallel (Closed)
Patch Set: rebase Created 3 years, 8 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 | « content/browser/download/parallel_download_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/parallel_download_utils_unittest.cc
diff --git a/content/browser/download/parallel_download_utils_unittest.cc b/content/browser/download/parallel_download_utils_unittest.cc
index eab9d3801cabd7961a2329632622955e4a1948c8..0d7cad92b86f11adf2a5e2110afba3dfed645b86 100644
--- a/content/browser/download/parallel_download_utils_unittest.cc
+++ b/content/browser/download/parallel_download_utils_unittest.cc
@@ -123,4 +123,18 @@ TEST(ParallelDownloadUtilsTest, FindSlicesForRemainingContentMinSliceSize) {
EXPECT_EQ(0, slices[0].received_bytes);
}
+TEST(ParallelDownloadUtilsTest, GetMaxContiguousDataBlockSizeFromBeginning) {
+ std::vector<DownloadItem::ReceivedSlice> slices;
+ slices.emplace_back(500, 500);
+ EXPECT_EQ(0, GetMaxContiguousDataBlockSizeFromBeginning(slices));
+
+ DownloadItem::ReceivedSlice slice1(0, 200);
+ AddOrMergeReceivedSliceIntoSortedArray(slice1, slices);
+ EXPECT_EQ(200, GetMaxContiguousDataBlockSizeFromBeginning(slices));
+
+ DownloadItem::ReceivedSlice slice2(200, 300);
+ AddOrMergeReceivedSliceIntoSortedArray(slice2, slices);
+ EXPECT_EQ(1000, GetMaxContiguousDataBlockSizeFromBeginning(slices));
+}
+
} // namespace content
« no previous file with comments | « content/browser/download/parallel_download_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698