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

Unified Diff: components/offline_pages/offline_page_storage_manager_unittest.cc

Issue 2067143004: [Offline Pages] Duplicate pages when save/delete bookmarks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments from dimich@. Created 4 years, 6 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/offline_pages/offline_page_model_impl_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/offline_page_storage_manager_unittest.cc
diff --git a/components/offline_pages/offline_page_storage_manager_unittest.cc b/components/offline_pages/offline_page_storage_manager_unittest.cc
index 3b52f54fe86c868dd0507e07c30c4c92b95caaae..75bda82b8faa57b5fdc1d8ca0983aca4e6454f72 100644
--- a/components/offline_pages/offline_page_storage_manager_unittest.cc
+++ b/components/offline_pages/offline_page_storage_manager_unittest.cc
@@ -30,7 +30,7 @@ namespace offline_pages {
namespace {
const GURL kTestUrl("http://example.com");
const base::FilePath::CharType kFilePath[] = FILE_PATH_LITERAL("/data");
-const int64_t kTestFileSize = 500 * (1 << 10);
+const int64_t kTestFileSize = 1 << 19; // Make a page 512KB.
const int64_t kFreeSpaceNormal = 100 * (1 << 20);
enum TestOptions {
@@ -291,13 +291,10 @@ TEST_F(OfflinePageStorageManagerTest, TestClearPagesMoreThanLimit) {
TEST_F(OfflinePageStorageManagerTest, TestClearPagesMoreFreshPages) {
Initialize(std::vector<PageSettings>(
{{kBookmarkNamespace, 30, 0}, {kLastNNamespace, 100, 1}}),
- {500 * (1 << 20), 0});
+ {1000 * (1 << 20), 0});
clock()->Advance(base::TimeDelta::FromMinutes(30));
TryClearPages();
- int last_n_page_limit = static_cast<int>(policy_controller()
- ->GetPolicy(kLastNNamespace)
- .lifetime_policy.page_limit);
- EXPECT_EQ(1 + (100 - last_n_page_limit), last_cleared_page_count());
+ EXPECT_EQ(1, last_cleared_page_count());
EXPECT_EQ(1, total_cleared_times());
EXPECT_EQ(ClearStorageResult::SUCCESS, last_clear_storage_result());
EXPECT_EQ(0, static_cast<int>(model()->GetRemovedPages().size()));
@@ -381,14 +378,13 @@ TEST_F(OfflinePageStorageManagerTest, TestTwoStepExpiration) {
TEST_F(OfflinePageStorageManagerTest, TestClearMultipleTimes) {
Initialize(std::vector<PageSettings>(
{{kBookmarkNamespace, 30, 0}, {kLastNNamespace, 100, 1}}),
- {500 * (1 << 20), 0});
+ {1000 * (1 << 20), 0});
clock()->Advance(base::TimeDelta::FromMinutes(30));
LifetimePolicy policy =
policy_controller()->GetPolicy(kLastNNamespace).lifetime_policy;
- int last_n_page_limit = static_cast<int>(policy.page_limit);
TryClearPages();
- EXPECT_EQ(1 + (100 - last_n_page_limit), last_cleared_page_count());
+ EXPECT_EQ(1, last_cleared_page_count());
EXPECT_EQ(1, total_cleared_times());
EXPECT_EQ(ClearStorageResult::SUCCESS, last_clear_storage_result());
EXPECT_EQ(0, static_cast<int>(model()->GetRemovedPages().size()));
@@ -397,7 +393,7 @@ TEST_F(OfflinePageStorageManagerTest, TestClearMultipleTimes) {
// expiring all pages left in the namespace.
clock()->Advance(policy.expiration_period);
TryClearPages();
- EXPECT_EQ(last_n_page_limit, last_cleared_page_count());
+ EXPECT_EQ(100, last_cleared_page_count());
EXPECT_EQ(2, total_cleared_times());
EXPECT_EQ(ClearStorageResult::SUCCESS, last_clear_storage_result());
EXPECT_EQ(0, static_cast<int>(model()->GetRemovedPages().size()));
« no previous file with comments | « components/offline_pages/offline_page_model_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698