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

Unified Diff: components/offline_pages/offline_page_model_impl_unittest.cc

Issue 2384423003: [Offline pages] Resetting offline page metadata store if initial load fails (Closed)
Patch Set: Rebased and comments addressed Created 4 years, 2 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 a65ef23c02b87be71f0671690ce94afce05ba0b3..e27fa43d9615e4bc130c8ad9bb9dbc6f1b9b15df 100644
--- a/components/offline_pages/offline_page_model_impl_unittest.cc
+++ b/components/offline_pages/offline_page_model_impl_unittest.cc
@@ -588,6 +588,28 @@ TEST_F(OfflinePageModelImplTest, GetAllPagesStoreFailure) {
EXPECT_EQ(0UL, offline_pages.size());
}
+TEST_F(OfflinePageModelImplTest, ResetStoreSuccess) {
+ GetStore()->set_test_scenario(
+ OfflinePageTestStore::TestScenario::RESET_SUCCESS);
+ ResetModel();
+ const std::vector<OfflinePageItem>& offline_pages = GetAllPages();
+
+ EXPECT_EQ(0UL, offline_pages.size());
+ EXPECT_TRUE(GetStore()->reset_called());
+ EXPECT_EQ(StoreState::LOADED, GetStore()->state());
+}
+
+TEST_F(OfflinePageModelImplTest, ResetStoreFailed) {
+ GetStore()->set_test_scenario(
+ OfflinePageTestStore::TestScenario::RESET_FAILED);
+ ResetModel();
+ const std::vector<OfflinePageItem>& offline_pages = GetAllPages();
+
+ EXPECT_EQ(0UL, offline_pages.size());
+ EXPECT_TRUE(GetStore()->reset_called());
+ EXPECT_EQ(StoreState::FAILED_RESET, GetStore()->state());
+}
+
TEST_F(OfflinePageModelImplTest, DeletePageSuccessful) {
OfflinePageTestStore* store = GetStore();

Powered by Google App Engine
This is Rietveld 408576698