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

Unified Diff: components/offline_pages/offline_page_model_unittest.cc

Issue 1487913002: [Offline pages] Fixing crashes caused by access to offline pages marked for deletion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: 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 | « components/offline_pages/offline_page_model.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_model_unittest.cc
diff --git a/components/offline_pages/offline_page_model_unittest.cc b/components/offline_pages/offline_page_model_unittest.cc
index cf661f974e11a48589a5ec61ef6b3540392e3d0f..a2df42e4b3aaba17f956ed40d87e71ff3598d2ae 100644
--- a/components/offline_pages/offline_page_model_unittest.cc
+++ b/components/offline_pages/offline_page_model_unittest.cc
@@ -600,6 +600,8 @@ TEST_F(OfflinePageModelTest, MarkPageForDeletion) {
base::Bind(&OfflinePageModelTest::OnSavePageDone, AsWeakPtr()));
PumpLoop();
+ GURL offline_url = model()->GetAllPages().begin()->GetOfflineURL();
+
// Delete the page with undo tiggerred.
model()->MarkPageForDeletion(
kTestPageBookmarkId1,
@@ -610,6 +612,11 @@ TEST_F(OfflinePageModelTest, MarkPageForDeletion) {
const std::vector<OfflinePageItem>& offline_pages = model()->GetAllPages();
EXPECT_EQ(0UL, offline_pages.size());
+ EXPECT_FALSE(model()->HasOfflinePages());
+ EXPECT_EQ(nullptr, model()->GetPageByOnlineURL(kTestUrl));
+ EXPECT_EQ(nullptr, model()->GetPageByBookmarkId(kTestPageBookmarkId1));
+ EXPECT_EQ(nullptr, model()->GetPageByOfflineURL(offline_url));
+
// Undo the deletion.
model()->UndoPageDeletion(kTestPageBookmarkId1);
base::RunLoop().RunUntilIdle();
« no previous file with comments | « components/offline_pages/offline_page_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698