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/content_suggestions_service.h" | 5 #include "components/ntp_snippets/content_suggestions_service.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 statuses_[category.id()] = CategoryStatus::AVAILABLE; | 53 statuses_[category.id()] = CategoryStatus::AVAILABLE; |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 CategoryStatus GetCategoryStatus(Category category) override { | 57 CategoryStatus GetCategoryStatus(Category category) override { |
58 return statuses_[category.id()]; | 58 return statuses_[category.id()]; |
59 } | 59 } |
60 | 60 |
61 CategoryInfo GetCategoryInfo(Category category) override { | 61 CategoryInfo GetCategoryInfo(Category category) override { |
62 return CategoryInfo(base::ASCIIToUTF16("Section title"), | 62 return CategoryInfo(base::ASCIIToUTF16("Section title"), |
63 ContentSuggestionsCardLayout::FULL_CARD, true, true); | 63 ContentSuggestionsCardLayout::FULL_CARD, true, true, |
| 64 base::ASCIIToUTF16("No suggestions message")); |
64 } | 65 } |
65 | 66 |
66 void FireSuggestionsChanged( | 67 void FireSuggestionsChanged( |
67 Category category, | 68 Category category, |
68 std::vector<ContentSuggestion> suggestions) { | 69 std::vector<ContentSuggestion> suggestions) { |
69 observer()->OnNewSuggestions(this, category, std::move(suggestions)); | 70 observer()->OnNewSuggestions(this, category, std::move(suggestions)); |
70 } | 71 } |
71 | 72 |
72 void FireCategoryStatusChanged(Category category, CategoryStatus new_status) { | 73 void FireCategoryStatusChanged(Category category, CategoryStatus new_status) { |
73 statuses_[category.id()] = new_status; | 74 statuses_[category.id()] = new_status; |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 provider = RegisterProvider(category); | 683 provider = RegisterProvider(category); |
683 provider->FireCategoryStatusChangedWithCurrentStatus(category); | 684 provider->FireCategoryStatusChangedWithCurrentStatus(category); |
684 EXPECT_TRUE(service()->IsCategoryDismissed(category)); | 685 EXPECT_TRUE(service()->IsCategoryDismissed(category)); |
685 | 686 |
686 service()->RestoreDismissedCategories(); | 687 service()->RestoreDismissedCategories(); |
687 EXPECT_FALSE(service()->IsCategoryDismissed(category)); | 688 EXPECT_FALSE(service()->IsCategoryDismissed(category)); |
688 EXPECT_THAT(providers().find(category)->second, Eq(provider)); | 689 EXPECT_THAT(providers().find(category)->second, Eq(provider)); |
689 } | 690 } |
690 | 691 |
691 } // namespace ntp_snippets | 692 } // namespace ntp_snippets |
OLD | NEW |