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

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: 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 f38fe3f90f61b554aa7849d86b18926aa6482032..9d9378cd1e5670d8a5e565d827d81f9cbbea7431 100644
--- a/components/offline_pages/offline_page_model_impl_unittest.cc
+++ b/components/offline_pages/offline_page_model_impl_unittest.cc
@@ -598,6 +598,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