| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 public OfflinePageTestArchiver::Observer, | 69 public OfflinePageTestArchiver::Observer, |
| 70 public base::SupportsWeakPtr<OfflinePageModelImplTest> { | 70 public base::SupportsWeakPtr<OfflinePageModelImplTest> { |
| 71 public: | 71 public: |
| 72 OfflinePageModelImplTest(); | 72 OfflinePageModelImplTest(); |
| 73 ~OfflinePageModelImplTest() override; | 73 ~OfflinePageModelImplTest() override; |
| 74 | 74 |
| 75 void SetUp() override; | 75 void SetUp() override; |
| 76 void TearDown() override; | 76 void TearDown() override; |
| 77 | 77 |
| 78 // OfflinePageModel::Observer implementation. | 78 // OfflinePageModel::Observer implementation. |
| 79 void OfflinePageModelLoaded(OfflinePageModel* model) override; | |
| 80 void OfflinePageModelChanged(OfflinePageModel* model) override; | |
| 81 void OfflinePageDeleted(int64_t offline_id, | 79 void OfflinePageDeleted(int64_t offline_id, |
| 82 const ClientId& client_id) override; | 80 const ClientId& client_id) override; |
| 83 | 81 |
| 84 // OfflinePageTestArchiver::Observer implementation. | 82 // OfflinePageTestArchiver::Observer implementation. |
| 85 void SetLastPathCreatedByArchiver(const base::FilePath& file_path) override; | 83 void SetLastPathCreatedByArchiver(const base::FilePath& file_path) override; |
| 86 | 84 |
| 87 // OfflinePageModel callbacks. | 85 // OfflinePageModel callbacks. |
| 88 void OnSavePageDone(SavePageResult result, int64_t offline_id); | 86 void OnSavePageDone(SavePageResult result, int64_t offline_id); |
| 89 void OnDeletePageDone(DeletePageResult result); | 87 void OnDeletePageDone(DeletePageResult result); |
| 90 void OnCheckPagesExistOfflineDone(const CheckPagesExistOfflineResult& result); | 88 void OnCheckPagesExistOfflineDone(const CheckPagesExistOfflineResult& result); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 model_->AddObserver(this); | 207 model_->AddObserver(this); |
| 210 PumpLoop(); | 208 PumpLoop(); |
| 211 } | 209 } |
| 212 | 210 |
| 213 void OfflinePageModelImplTest::TearDown() { | 211 void OfflinePageModelImplTest::TearDown() { |
| 214 model_->RemoveObserver(this); | 212 model_->RemoveObserver(this); |
| 215 model_.reset(); | 213 model_.reset(); |
| 216 PumpLoop(); | 214 PumpLoop(); |
| 217 } | 215 } |
| 218 | 216 |
| 219 void OfflinePageModelImplTest::OfflinePageModelLoaded(OfflinePageModel* model) { | |
| 220 ASSERT_EQ(model_.get(), model); | |
| 221 } | |
| 222 | |
| 223 void OfflinePageModelImplTest::OfflinePageModelChanged( | |
| 224 OfflinePageModel* model) { | |
| 225 ASSERT_EQ(model_.get(), model); | |
| 226 } | |
| 227 | |
| 228 void OfflinePageModelImplTest::OfflinePageDeleted(int64_t offline_id, | 217 void OfflinePageModelImplTest::OfflinePageDeleted(int64_t offline_id, |
| 229 const ClientId& client_id) { | 218 const ClientId& client_id) { |
| 230 last_deleted_offline_id_ = offline_id; | 219 last_deleted_offline_id_ = offline_id; |
| 231 last_deleted_client_id_ = client_id; | 220 last_deleted_client_id_ = client_id; |
| 232 } | 221 } |
| 233 | 222 |
| 234 void OfflinePageModelImplTest::SetLastPathCreatedByArchiver( | 223 void OfflinePageModelImplTest::SetLastPathCreatedByArchiver( |
| 235 const base::FilePath& file_path) { | 224 const base::FilePath& file_path) { |
| 236 last_archiver_path_ = file_path; | 225 last_archiver_path_ = file_path; |
| 237 } | 226 } |
| (...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 // Check if feature is correctly enabled by command-line flag. | 1234 // Check if feature is correctly enabled by command-line flag. |
| 1246 scoped_feature_list.reset(new base::test::ScopedFeatureList); | 1235 scoped_feature_list.reset(new base::test::ScopedFeatureList); |
| 1247 scoped_feature_list->InitFromCommandLine( | 1236 scoped_feature_list->InitFromCommandLine( |
| 1248 std::string(kOfflineBookmarksFeature.name) + "," + | 1237 std::string(kOfflineBookmarksFeature.name) + "," + |
| 1249 kOfflinePagesSharingFeature.name, | 1238 kOfflinePagesSharingFeature.name, |
| 1250 ""); | 1239 ""); |
| 1251 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled()); | 1240 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled()); |
| 1252 } | 1241 } |
| 1253 | 1242 |
| 1254 } // namespace offline_pages | 1243 } // namespace offline_pages |
| OLD | NEW |