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 #include "components/ntp_snippets/offline_pages/offline_pages_test_utils.h" | 5 #include "components/ntp_snippets/offline_pages/offline_pages_test_utils.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 is_loaded_ = true; | 24 is_loaded_ = true; |
25 } | 25 } |
26 | 26 |
27 FakeOfflinePageModel::~FakeOfflinePageModel() {} | 27 FakeOfflinePageModel::~FakeOfflinePageModel() {} |
28 | 28 |
29 void FakeOfflinePageModel::GetPagesMatchingQuery( | 29 void FakeOfflinePageModel::GetPagesMatchingQuery( |
30 std::unique_ptr<offline_pages::OfflinePageModelQuery> query, | 30 std::unique_ptr<offline_pages::OfflinePageModelQuery> query, |
31 const MultipleOfflinePageItemCallback& callback) { | 31 const MultipleOfflinePageItemCallback& callback) { |
32 MultipleOfflinePageItemResult filtered_result; | 32 MultipleOfflinePageItemResult filtered_result; |
33 for (auto& item : items_) { | 33 for (auto& item : items_) { |
34 if (query->Matches(item)) | 34 if (query->Matches(item)) { |
35 filtered_result.emplace_back(item); | 35 filtered_result.emplace_back(item); |
| 36 } |
36 } | 37 } |
37 callback.Run(filtered_result); | 38 callback.Run(filtered_result); |
38 } | 39 } |
39 | 40 |
40 void FakeOfflinePageModel::GetAllPages( | 41 void FakeOfflinePageModel::GetAllPages( |
41 const MultipleOfflinePageItemCallback& callback) { | 42 const MultipleOfflinePageItemCallback& callback) { |
42 callback.Run(items_); | 43 callback.Run(items_); |
43 } | 44 } |
44 | 45 |
45 const std::vector<OfflinePageItem>& FakeOfflinePageModel::items() { | 46 const std::vector<OfflinePageItem>& FakeOfflinePageModel::items() { |
(...skipping 24 matching lines...) Expand all Loading... |
70 | 71 |
71 void CaptureDismissedSuggestions( | 72 void CaptureDismissedSuggestions( |
72 std::vector<ContentSuggestion>* captured_suggestions, | 73 std::vector<ContentSuggestion>* captured_suggestions, |
73 std::vector<ContentSuggestion> dismissed_suggestions) { | 74 std::vector<ContentSuggestion> dismissed_suggestions) { |
74 std::move(dismissed_suggestions.begin(), dismissed_suggestions.end(), | 75 std::move(dismissed_suggestions.begin(), dismissed_suggestions.end(), |
75 std::back_inserter(*captured_suggestions)); | 76 std::back_inserter(*captured_suggestions)); |
76 } | 77 } |
77 | 78 |
78 } // namespace test | 79 } // namespace test |
79 } // namespace ntp_snippets | 80 } // namespace ntp_snippets |
OLD | NEW |