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

Unified Diff: components/precache/core/precache_database_unittest.cc

Issue 1961153003: Add pause/resume functionality to precache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: components/precache/core/precache_database_unittest.cc
diff --git a/components/precache/core/precache_database_unittest.cc b/components/precache/core/precache_database_unittest.cc
index 3f9253c744af757c3272e89fc7f0eceeb8b34204..cd9fb8ca7c8c12ab75e798c896458a28f3eabbe5 100644
--- a/components/precache/core/precache_database_unittest.cc
+++ b/components/precache/core/precache_database_unittest.cc
@@ -381,6 +381,43 @@ TEST_F(PrecacheDatabaseTest, SampleInteraction) {
ElementsAre(Bucket(kSize1, 1)));
}
+TEST_F(PrecacheDatabaseTest, SaveAndGetUnfinishedWork) {
+ std::list<GURL> manifests1, resources1, manifests2, resources2;
+ manifests1.push_back(GURL("http://www.m1.com/"));
+ resources1.push_back(GURL("http://www.r1.com/"));
+ manifests2.push_back(GURL("http://www.m2.com/"));
+ resources2.push_back(GURL("http://www.r2.com/"));
+ scoped_refptr<UnfinishedWork> unfinished_work =
+ new UnfinishedWork(manifests1, resources1, 1, 2, 3,
+ base::TimeTicks::FromInternalValue(100));
+ scoped_refptr<UnfinishedWork> unfinished_work2 =
+ new UnfinishedWork(manifests2, resources2, 4, 5, 6,
+ base::TimeTicks::FromInternalValue(200));
+ scoped_refptr<UnfinishedWork> unfinished_work3 =
+ new UnfinishedWork(base::TimeTicks::FromInternalValue(300));
+ scoped_refptr<UnfinishedWork> unfinished_work4 =
+ new UnfinishedWork(base::TimeTicks::FromInternalValue(50));
+ precache_database_->SaveUnfinishedWork(unfinished_work);
+ precache_database_->SaveUnfinishedWork(unfinished_work2);
+ precache_database_->GetUnfinishedWork(unfinished_work3);
+ precache_database_->GetUnfinishedWork(unfinished_work4);
+ EXPECT_TRUE(unfinished_work3->manifests.empty());
+ EXPECT_TRUE(unfinished_work3->resources.empty());
+ EXPECT_EQ(unfinished_work2->total_bytes, unfinished_work3->total_bytes);
+ EXPECT_EQ(unfinished_work2->network_bytes, unfinished_work3->network_bytes);
+ EXPECT_EQ(unfinished_work2->num_manifest_urls,
+ unfinished_work3->num_manifest_urls);
+ EXPECT_EQ(unfinished_work2->start_time, unfinished_work3->start_time);
+
+ EXPECT_EQ(unfinished_work2->manifests, unfinished_work4->manifests);
+ EXPECT_EQ(unfinished_work2->resources, unfinished_work4->resources);
+ EXPECT_EQ(unfinished_work2->total_bytes, unfinished_work4->total_bytes);
+ EXPECT_EQ(unfinished_work2->network_bytes, unfinished_work4->network_bytes);
+ EXPECT_EQ(unfinished_work2->num_manifest_urls,
+ unfinished_work4->num_manifest_urls);
+ EXPECT_EQ(unfinished_work2->start_time, unfinished_work4->start_time);
+}
+
} // namespace
} // namespace precache

Powered by Google App Engine
This is Rietveld 408576698