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

Unified Diff: chrome/browser/browsing_data/cache_counter_browsertest.cc

Issue 2556363003: Refactor cache counting into a separate helper class (Closed)
Patch Set: Remove code depending on GetEntrySize() Created 3 years, 11 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 | « chrome/browser/browsing_data/cache_counter.cc ('k') | chrome/browser/browsing_data/cache_test_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data/cache_counter_browsertest.cc
diff --git a/chrome/browser/browsing_data/cache_counter_browsertest.cc b/chrome/browser/browsing_data/cache_counter_browsertest.cc
index a953f7fb4a0f0cbd1953107c68704e0f9e78c9e9..a48f7215dcdccfce279d8f7e26fab5fb9193fc7a 100644
--- a/chrome/browser/browsing_data/cache_counter_browsertest.cc
+++ b/chrome/browser/browsing_data/cache_counter_browsertest.cc
@@ -138,10 +138,9 @@ class CacheCounterTest : public InProcessBrowserTest {
finished_ = result->Finished();
if (finished_) {
- result_ =
- static_cast<browsing_data::BrowsingDataCounter::FinishedResult*>(
- result.get())
- ->Value();
+ auto cache_result = static_cast<CacheCounter::CacheResult*>(result.get());
+ result_ = cache_result->cache_size();
+ is_upper_limit_ = cache_result->is_upper_limit();
}
if (run_loop_ && finished_)
@@ -153,6 +152,11 @@ class CacheCounterTest : public InProcessBrowserTest {
return result_;
}
+ bool IsUpperLimit() {
+ DCHECK(finished_);
+ return is_upper_limit_;
+ }
+
private:
enum CacheEntryCreationStep {
GET_CACHE,
@@ -169,6 +173,7 @@ class CacheCounterTest : public InProcessBrowserTest {
bool finished_;
browsing_data::BrowsingDataCounter::ResultInt result_;
+ bool is_upper_limit_;
};
// Tests that for the empty cache, the result is zero.
@@ -268,22 +273,27 @@ IN_PROC_BROWSER_TEST_F(CacheCounterTest, PeriodChanged) {
SetDeletionPeriodPref(browsing_data::LAST_HOUR);
WaitForIOThread();
browsing_data::BrowsingDataCounter::ResultInt result = GetResult();
+ EXPECT_TRUE(IsUpperLimit());
SetDeletionPeriodPref(browsing_data::LAST_DAY);
WaitForIOThread();
EXPECT_EQ(result, GetResult());
+ EXPECT_TRUE(IsUpperLimit());
SetDeletionPeriodPref(browsing_data::LAST_WEEK);
WaitForIOThread();
EXPECT_EQ(result, GetResult());
+ EXPECT_TRUE(IsUpperLimit());
SetDeletionPeriodPref(browsing_data::FOUR_WEEKS);
WaitForIOThread();
EXPECT_EQ(result, GetResult());
+ EXPECT_TRUE(IsUpperLimit());
SetDeletionPeriodPref(browsing_data::ALL_TIME);
WaitForIOThread();
EXPECT_EQ(result, GetResult());
+ EXPECT_FALSE(IsUpperLimit());
}
} // namespace
« no previous file with comments | « chrome/browser/browsing_data/cache_counter.cc ('k') | chrome/browser/browsing_data/cache_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698