| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/offline_pages/offline_page_model_impl.h" | 5 #include "components/offline_pages/offline_page_model_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 } | 591 } |
| 592 | 592 |
| 593 TEST_F(OfflinePageModelImplTest, GetAllPagesStoreFailure) { | 593 TEST_F(OfflinePageModelImplTest, GetAllPagesStoreFailure) { |
| 594 GetStore()->set_test_scenario( | 594 GetStore()->set_test_scenario( |
| 595 OfflinePageTestStore::TestScenario::LOAD_FAILED); | 595 OfflinePageTestStore::TestScenario::LOAD_FAILED); |
| 596 const std::vector<OfflinePageItem>& offline_pages = GetAllPages(); | 596 const std::vector<OfflinePageItem>& offline_pages = GetAllPages(); |
| 597 | 597 |
| 598 EXPECT_EQ(0UL, offline_pages.size()); | 598 EXPECT_EQ(0UL, offline_pages.size()); |
| 599 } | 599 } |
| 600 | 600 |
| 601 TEST_F(OfflinePageModelImplTest, ResetStoreSuccess) { |
| 602 GetStore()->set_test_scenario( |
| 603 OfflinePageTestStore::TestScenario::RESET_SUCCESS); |
| 604 ResetModel(); |
| 605 const std::vector<OfflinePageItem>& offline_pages = GetAllPages(); |
| 606 |
| 607 EXPECT_EQ(0UL, offline_pages.size()); |
| 608 EXPECT_TRUE(GetStore()->reset_called()); |
| 609 EXPECT_EQ(StoreState::LOADED, GetStore()->state()); |
| 610 } |
| 611 |
| 612 TEST_F(OfflinePageModelImplTest, ResetStoreFailed) { |
| 613 GetStore()->set_test_scenario( |
| 614 OfflinePageTestStore::TestScenario::RESET_FAILED); |
| 615 ResetModel(); |
| 616 const std::vector<OfflinePageItem>& offline_pages = GetAllPages(); |
| 617 |
| 618 EXPECT_EQ(0UL, offline_pages.size()); |
| 619 EXPECT_TRUE(GetStore()->reset_called()); |
| 620 EXPECT_EQ(StoreState::FAILED_RESET, GetStore()->state()); |
| 621 } |
| 622 |
| 601 TEST_F(OfflinePageModelImplTest, DeletePageSuccessful) { | 623 TEST_F(OfflinePageModelImplTest, DeletePageSuccessful) { |
| 602 OfflinePageTestStore* store = GetStore(); | 624 OfflinePageTestStore* store = GetStore(); |
| 603 | 625 |
| 604 // Save one page. | 626 // Save one page. |
| 605 SavePage(kTestUrl, kTestClientId1); | 627 SavePage(kTestUrl, kTestClientId1); |
| 606 int64_t offline1 = last_save_offline_id(); | 628 int64_t offline1 = last_save_offline_id(); |
| 607 EXPECT_EQ(SavePageResult::SUCCESS, last_save_result()); | 629 EXPECT_EQ(SavePageResult::SUCCESS, last_save_result()); |
| 608 EXPECT_EQ(1u, store->GetAllPages().size()); | 630 EXPECT_EQ(1u, store->GetAllPages().size()); |
| 609 | 631 |
| 610 ResetResults(); | 632 ResetResults(); |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1200 // Check if feature is correctly enabled by command-line flag. | 1222 // Check if feature is correctly enabled by command-line flag. |
| 1201 scoped_feature_list.reset(new base::test::ScopedFeatureList); | 1223 scoped_feature_list.reset(new base::test::ScopedFeatureList); |
| 1202 scoped_feature_list->InitFromCommandLine( | 1224 scoped_feature_list->InitFromCommandLine( |
| 1203 std::string(kOfflineBookmarksFeature.name) + "," + | 1225 std::string(kOfflineBookmarksFeature.name) + "," + |
| 1204 kOfflinePagesSharingFeature.name, | 1226 kOfflinePagesSharingFeature.name, |
| 1205 ""); | 1227 ""); |
| 1206 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled()); | 1228 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled()); |
| 1207 } | 1229 } |
| 1208 | 1230 |
| 1209 } // namespace offline_pages | 1231 } // namespace offline_pages |
| OLD | NEW |