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

Unified Diff: components/offline_pages/offline_page_model_impl_unittest.cc

Issue 2041983006: [Offline Pages] Filtering expired pages and fix consistency check. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: components/offline_pages/offline_page_model_impl_unittest.cc
diff --git a/components/offline_pages/offline_page_model_impl_unittest.cc b/components/offline_pages/offline_page_model_impl_unittest.cc
index 3652c6004ebb732e0cb86a811788928d0f1fc14c..d3d67ddaddefa59aa7e99f8f77f51f43e65acca3 100644
--- a/components/offline_pages/offline_page_model_impl_unittest.cc
+++ b/components/offline_pages/offline_page_model_impl_unittest.cc
@@ -730,7 +730,7 @@ TEST_F(OfflinePageModelImplTest, DetectThatOfflineCopyIsMissing) {
model()->CheckForExternalFileDeletion();
PumpLoop();
- EXPECT_EQ(last_deleted_offline_id(), offline_id);
+ // Check if the page has been expired.
EXPECT_EQ(0UL, GetAllPages().size());
}
@@ -749,10 +749,31 @@ TEST_F(OfflinePageModelImplTest, DetectThatOfflineCopyIsMissingAfterLoad) {
ResetModel();
PumpLoop();
- EXPECT_EQ(last_deleted_offline_id(), offline_id);
+ // Check if the page has been expired.
EXPECT_EQ(0UL, GetAllPages().size());
}
+TEST_F(OfflinePageModelImplTest, DetectThatHeadlessPageIsDeleted) {
+ // Save a page.
+ SavePage(kTestUrl, kTestClientId1);
+ PumpLoop();
+ int64_t offline_id = last_save_offline_id();
+
+ ResetResults();
+ base::Optional<OfflinePageItem> page = GetPageByOfflineId(offline_id);
+ base::FilePath path = page->file_path;
+ EXPECT_TRUE(base::PathExists(path));
fgorski 2016/06/07 22:46:15 Could you also add this check before CheckForExter
romax 2016/06/08 01:31:26 Done.
+ GetStore()->ClearAllPages();
+ ResetModel();
+ PumpLoop();
+
+ model()->CheckForExternalFileDeletion();
+ PumpLoop();
+
+ EXPECT_EQ(0UL, GetAllPages().size());
+ EXPECT_FALSE(base::PathExists(path));
+}
+
TEST_F(OfflinePageModelImplTest, DeleteMultiplePages) {
OfflinePageTestStore* store = GetStore();

Powered by Google App Engine
This is Rietveld 408576698