| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/mock_content_suggestions_provider.h" | 5 #include "components/ntp_snippets/mock_content_suggestions_provider.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 } | 30 } |
| 31 | 31 |
| 32 CategoryStatus MockContentSuggestionsProvider::GetCategoryStatus( | 32 CategoryStatus MockContentSuggestionsProvider::GetCategoryStatus( |
| 33 Category category) { | 33 Category category) { |
| 34 return statuses_[category.id()]; | 34 return statuses_[category.id()]; |
| 35 } | 35 } |
| 36 | 36 |
| 37 CategoryInfo MockContentSuggestionsProvider::GetCategoryInfo( | 37 CategoryInfo MockContentSuggestionsProvider::GetCategoryInfo( |
| 38 Category category) { | 38 Category category) { |
| 39 return CategoryInfo(base::ASCIIToUTF16("Section title"), | 39 return CategoryInfo(base::ASCIIToUTF16("Section title"), |
| 40 ContentSuggestionsCardLayout::FULL_CARD, true, false, | 40 ContentSuggestionsCardLayout::FULL_CARD, |
| 41 true, false, | 41 /*has_fetch_action=*/true, |
| 42 /*has_view_all_action=*/true, |
| 43 /*show_if_empty=*/false, |
| 42 base::ASCIIToUTF16("No suggestions message")); | 44 base::ASCIIToUTF16("No suggestions message")); |
| 43 } | 45 } |
| 44 | 46 |
| 45 void MockContentSuggestionsProvider::FireSuggestionsChanged( | 47 void MockContentSuggestionsProvider::FireSuggestionsChanged( |
| 46 Category category, | 48 Category category, |
| 47 std::vector<ContentSuggestion> suggestions) { | 49 std::vector<ContentSuggestion> suggestions) { |
| 48 observer()->OnNewSuggestions(this, category, std::move(suggestions)); | 50 observer()->OnNewSuggestions(this, category, std::move(suggestions)); |
| 49 } | 51 } |
| 50 | 52 |
| 51 void MockContentSuggestionsProvider::FireCategoryStatusChanged( | 53 void MockContentSuggestionsProvider::FireCategoryStatusChanged( |
| 52 Category category, | 54 Category category, |
| 53 CategoryStatus new_status) { | 55 CategoryStatus new_status) { |
| 54 statuses_[category.id()] = new_status; | 56 statuses_[category.id()] = new_status; |
| 55 observer()->OnCategoryStatusChanged(this, category, new_status); | 57 observer()->OnCategoryStatusChanged(this, category, new_status); |
| 56 } | 58 } |
| 57 | 59 |
| 58 void MockContentSuggestionsProvider::FireCategoryStatusChangedWithCurrentStatus( | 60 void MockContentSuggestionsProvider::FireCategoryStatusChangedWithCurrentStatus( |
| 59 Category category) { | 61 Category category) { |
| 60 observer()->OnCategoryStatusChanged(this, category, statuses_[category.id()]); | 62 observer()->OnCategoryStatusChanged(this, category, statuses_[category.id()]); |
| 61 } | 63 } |
| 62 | 64 |
| 63 void MockContentSuggestionsProvider::FireSuggestionInvalidated( | 65 void MockContentSuggestionsProvider::FireSuggestionInvalidated( |
| 64 const ContentSuggestion::ID& suggestion_id) { | 66 const ContentSuggestion::ID& suggestion_id) { |
| 65 observer()->OnSuggestionInvalidated(this, suggestion_id); | 67 observer()->OnSuggestionInvalidated(this, suggestion_id); |
| 66 } | 68 } |
| 67 | 69 |
| 68 } // namespace ntp_snippets | 70 } // namespace ntp_snippets |
| OLD | NEW |