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

Unified Diff: components/precache/content/precache_manager_unittest.cc

Issue 2123813002: Report Precache.TimeSinceLastPrecache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gclient sync Created 4 years, 5 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 | « components/precache/content/precache_manager.cc ('k') | components/precache/core/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/precache/content/precache_manager_unittest.cc
diff --git a/components/precache/content/precache_manager_unittest.cc b/components/precache/content/precache_manager_unittest.cc
index d075231b4b0aa96e5f9110b285b9d80f426f5d69..7e62d23fc9525f91064b0b33aaf22847aa9da249 100644
--- a/components/precache/content/precache_manager_unittest.cc
+++ b/components/precache/content/precache_manager_unittest.cc
@@ -243,6 +243,8 @@ TEST_F(PrecacheManagerTest, StartAndFinishPrecachingWithUnfinishedHosts) {
GURL(kEvilManifestURL), "",
net::HTTP_OK, net::URLRequestStatus::SUCCESS);
+ ASSERT_TRUE(precache_database_->GetLastPrecacheTimestamp().is_null());
+
precache_manager_->StartPrecaching(precache_callback_.GetCallback());
EXPECT_TRUE(precache_manager_->IsPrecaching());
@@ -250,6 +252,9 @@ TEST_F(PrecacheManagerTest, StartAndFinishPrecachingWithUnfinishedHosts) {
EXPECT_FALSE(precache_manager_->IsPrecaching());
EXPECT_TRUE(precache_callback_.was_on_done_called());
+ // The LastPrecacheTimestamp has been set.
+ EXPECT_FALSE(precache_database_->GetLastPrecacheTimestamp().is_null());
+
std::multiset<GURL> expected_requested_urls;
expected_requested_urls.insert(GURL(kConfigURL));
expected_requested_urls.insert(GURL(kEvilManifestURL));
@@ -505,6 +510,7 @@ TEST_F(PrecacheManagerTest, DeleteExpiredPrecacheHistory) {
expected_histogram_count_map["Precache.Fetch.TimeToComplete"]++;
expected_histogram_count_map["Precache.Latency.NonPrefetch"]++;
expected_histogram_count_map["Precache.Latency.NonPrefetch.NonTopHosts"]++;
+ expected_histogram_count_map["Precache.TimeSinceLastPrecache"] += 1;
base::RunLoop().RunUntilIdle();
EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."),
@@ -521,6 +527,7 @@ TEST_F(PrecacheManagerTest, DeleteExpiredPrecacheHistory) {
expected_histogram_count_map["Precache.Latency.NonPrefetch"] += 2;
expected_histogram_count_map["Precache.Latency.NonPrefetch.NonTopHosts"] += 2;
expected_histogram_count_map["Precache.Saved"] += 2;
+ expected_histogram_count_map["Precache.TimeSinceLastPrecache"] += 2;
base::RunLoop().RunUntilIdle();
EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."),
« no previous file with comments | « components/precache/content/precache_manager.cc ('k') | components/precache/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698