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

Unified Diff: content/browser/quota/quota_manager_unittest.cc

Issue 1424653002: Add access count and time-since-accessed histograms to temp storage eviction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@quota_uma
Patch Set: address comment Created 5 years, 1 month 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/quota/quota_database_unittest.cc ('k') | storage/browser/quota/quota_database.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/quota/quota_manager_unittest.cc
diff --git a/content/browser/quota/quota_manager_unittest.cc b/content/browser/quota/quota_manager_unittest.cc
index 6a7d1d9be47233e0d003b3de32aa77d5fac5385b..bf61ff3d22c81155a83dd5ebd8a05aa465ac5190 100644
--- a/content/browser/quota/quota_manager_unittest.cc
+++ b/content/browser/quota/quota_manager_unittest.cc
@@ -1377,19 +1377,40 @@ TEST_F(QuotaManagerTest, EvictOriginDataHistogram) {
EvictOriginData(GURL("http://foo.com/"), kTemp);
base::RunLoop().RunUntilIdle();
+ // Ensure used count and time since access are recorded.
+ histograms.ExpectTotalCount(
+ QuotaManager::kEvictedOriginAccessedCountHistogram, 1);
+ histograms.ExpectBucketCount(
+ QuotaManager::kEvictedOriginAccessedCountHistogram, 0, 1);
+ histograms.ExpectTotalCount(
+ QuotaManager::kEvictedOriginTimeSinceAccessHistogram, 1);
michaeln 2015/11/05 00:01:23 ooops, wait... this test is red?
calamity 2015/11/05 07:10:47 Only ran quota database tests locally after the ch
+
// First eviction has no 'last' time to compare to.
histograms.ExpectTotalCount(
QuotaManager::kTimeBetweenRepeatedOriginEvictionsHistogram, 0);
client->AddOriginAndNotify(GURL("http://foo.com"), kTemp, 100);
+ // Change the used count of the origin.
+ quota_manager()->NotifyStorageAccessed(QuotaClient::kUnknown, GURL(kOrigin),
+ kTemp);
+ base::RunLoop().RunUntilIdle();
+
GetGlobalUsage(kTemp);
base::RunLoop().RunUntilIdle();
EvictOriginData(GURL("http://foo.com/"), kTemp);
base::RunLoop().RunUntilIdle();
- // Second eviction should log a histogram sample.
+ // The new used count should be logged.
+ histograms.ExpectTotalCount(
+ QuotaManager::kEvictedOriginAccessedCountHistogram, 2);
+ histograms.ExpectBucketCount(
+ QuotaManager::kEvictedOriginAccessedCountHistogram, 1, 1);
+ histograms.ExpectTotalCount(
+ QuotaManager::kEvictedOriginTimeSinceAccessHistogram, 2);
+
+ // Second eviction should log a 'time between repeated eviction' sample.
histograms.ExpectTotalCount(
QuotaManager::kTimeBetweenRepeatedOriginEvictionsHistogram, 1);
« no previous file with comments | « content/browser/quota/quota_database_unittest.cc ('k') | storage/browser/quota/quota_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698