| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGES_TEST_UTILS_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGES_TEST_UTILS_H_ |
| 6 #define COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGES_TEST_UTILS_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGES_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include "components/ntp_snippets/content_suggestion.h" | 8 #include "components/ntp_snippets/content_suggestion.h" |
| 9 #include "components/offline_pages/core/offline_page_item.h" | 9 #include "components/offline_pages/core/offline_page_item.h" |
| 10 #include "components/offline_pages/core/stub_offline_page_model.h" | 10 #include "components/offline_pages/core/stub_offline_page_model.h" |
| 11 | 11 |
| 12 namespace ntp_snippets { | 12 namespace ntp_snippets { |
| 13 namespace test { | 13 namespace test { |
| 14 | 14 |
| 15 class FakeOfflinePageModel : public offline_pages::StubOfflinePageModel { | 15 class FakeOfflinePageModel : public offline_pages::StubOfflinePageModel { |
| 16 public: | 16 public: |
| 17 FakeOfflinePageModel(); | 17 FakeOfflinePageModel(); |
| 18 ~FakeOfflinePageModel() override; | 18 ~FakeOfflinePageModel() override; |
| 19 | 19 |
| 20 void GetPagesMatchingQuery( | 20 void GetPagesMatchingQuery( |
| 21 std::unique_ptr<offline_pages::OfflinePageModelQuery> query, | 21 std::unique_ptr<offline_pages::OfflinePageModelQuery> query, |
| 22 const offline_pages::MultipleOfflinePageItemCallback& callback) override; | 22 const offline_pages::MultipleOfflinePageItemCallback& callback) override; |
| 23 | 23 |
| 24 void GetAllPages( | 24 void GetAllPages( |
| 25 const offline_pages::MultipleOfflinePageItemCallback& callback) override; | 25 const offline_pages::MultipleOfflinePageItemCallback& callback) override; |
| 26 | 26 |
| 27 const std::vector<offline_pages::OfflinePageItem>& items(); | 27 const std::vector<offline_pages::OfflinePageItem>& items(); |
| 28 std::vector<offline_pages::OfflinePageItem>* mutable_items(); | 28 std::vector<offline_pages::OfflinePageItem>* mutable_items(); |
| 29 | 29 |
| 30 bool is_loaded() const override; | |
| 31 void set_is_loaded(bool value); | |
| 32 | |
| 33 private: | 30 private: |
| 34 std::vector<offline_pages::OfflinePageItem> items_; | 31 std::vector<offline_pages::OfflinePageItem> items_; |
| 35 bool is_loaded_; | |
| 36 | 32 |
| 37 DISALLOW_COPY_AND_ASSIGN(FakeOfflinePageModel); | 33 DISALLOW_COPY_AND_ASSIGN(FakeOfflinePageModel); |
| 38 }; | 34 }; |
| 39 | 35 |
| 40 offline_pages::OfflinePageItem CreateDummyOfflinePageItem( | 36 offline_pages::OfflinePageItem CreateDummyOfflinePageItem( |
| 41 int id, | 37 int id, |
| 42 const std::string& name_space); | 38 const std::string& name_space); |
| 43 | 39 |
| 44 void CaptureDismissedSuggestions( | 40 void CaptureDismissedSuggestions( |
| 45 std::vector<ntp_snippets::ContentSuggestion>* captured_suggestions, | 41 std::vector<ntp_snippets::ContentSuggestion>* captured_suggestions, |
| 46 std::vector<ntp_snippets::ContentSuggestion> dismissed_suggestions); | 42 std::vector<ntp_snippets::ContentSuggestion> dismissed_suggestions); |
| 47 | 43 |
| 48 } // namespace test | 44 } // namespace test |
| 49 } // namespace ntp_snippets | 45 } // namespace ntp_snippets |
| 50 | 46 |
| 51 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGES_TEST_UTILS_H_ | 47 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGES_TEST_UTILS_H_ |
| OLD | NEW |