| 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 | 763 |
| 764 TEST_F(OfflinePageModelImplTest, DetectThatOfflineCopyIsMissing) { | 764 TEST_F(OfflinePageModelImplTest, DetectThatOfflineCopyIsMissing) { |
| 765 // Save a page. | 765 // Save a page. |
| 766 SavePage(kTestUrl, kTestClientId1); | 766 SavePage(kTestUrl, kTestClientId1); |
| 767 int64_t offline_id = last_save_offline_id(); | 767 int64_t offline_id = last_save_offline_id(); |
| 768 | 768 |
| 769 ResetResults(); | 769 ResetResults(); |
| 770 | 770 |
| 771 const OfflinePageItem* page = GetPageByOfflineId(offline_id); | 771 const OfflinePageItem* page = GetPageByOfflineId(offline_id); |
| 772 | 772 |
| 773 // Delete the offline copy of the page and check the metadata. | 773 // Delete the offline copy of the page. |
| 774 base::DeleteFile(page->file_path, false); | 774 base::DeleteFile(page->file_path, false); |
| 775 model()->CheckMetadataConsistency(); | 775 |
| 776 // Resetting the model will cause a consistency check. |
| 777 ResetModel(); |
| 778 |
| 776 PumpLoop(); | 779 PumpLoop(); |
| 777 | 780 |
| 778 // Check if the page has been expired. | 781 // Check if the page has been expired. |
| 779 EXPECT_EQ(0UL, GetAllPages().size()); | 782 EXPECT_EQ(0UL, GetAllPages().size()); |
| 780 } | 783 } |
| 781 | 784 |
| 782 TEST_F(OfflinePageModelImplTest, DetectThatOfflineCopyIsMissingAfterLoad) { | 785 TEST_F(OfflinePageModelImplTest, DetectThatOfflineCopyIsMissingAfterLoad) { |
| 783 // Save a page. | 786 // Save a page. |
| 784 SavePage(kTestUrl, kTestClientId1); | 787 SavePage(kTestUrl, kTestClientId1); |
| 785 PumpLoop(); | 788 PumpLoop(); |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 // Check if feature is correctly enabled by command-line flag. | 1230 // Check if feature is correctly enabled by command-line flag. |
| 1228 scoped_feature_list.reset(new base::test::ScopedFeatureList); | 1231 scoped_feature_list.reset(new base::test::ScopedFeatureList); |
| 1229 scoped_feature_list->InitFromCommandLine( | 1232 scoped_feature_list->InitFromCommandLine( |
| 1230 std::string(kOfflineBookmarksFeature.name) + "," + | 1233 std::string(kOfflineBookmarksFeature.name) + "," + |
| 1231 kOfflinePagesSharingFeature.name, | 1234 kOfflinePagesSharingFeature.name, |
| 1232 ""); | 1235 ""); |
| 1233 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled()); | 1236 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled()); |
| 1234 } | 1237 } |
| 1235 | 1238 |
| 1236 } // namespace offline_pages | 1239 } // namespace offline_pages |
| OLD | NEW |