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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 std::vector<Category> GetProvidedCategories() override { | 74 std::vector<Category> GetProvidedCategories() override { |
75 return provided_categories_; | 75 return provided_categories_; |
76 } | 76 } |
77 | 77 |
78 CategoryStatus GetCategoryStatus(Category category) { | 78 CategoryStatus GetCategoryStatus(Category category) { |
79 return statuses_[category.id()]; | 79 return statuses_[category.id()]; |
80 } | 80 } |
81 | 81 |
82 CategoryInfo GetCategoryInfo(Category category) { | 82 CategoryInfo GetCategoryInfo(Category category) { |
83 return CategoryInfo(base::ASCIIToUTF16("Section title"), | 83 return CategoryInfo(base::ASCIIToUTF16("Section title"), |
84 ContentSuggestionsCardLayout::FULL_CARD, true); | 84 ContentSuggestionsCardLayout::FULL_CARD, true, true); |
85 } | 85 } |
86 | 86 |
87 void FireSuggestionsChanged(Category category, | 87 void FireSuggestionsChanged(Category category, |
88 const std::vector<int>& numbers) { | 88 const std::vector<int>& numbers) { |
89 observer()->OnNewSuggestions(this, category, CreateSuggestions(numbers)); | 89 observer()->OnNewSuggestions(this, category, CreateSuggestions(numbers)); |
90 } | 90 } |
91 | 91 |
92 void FireCategoryStatusChanged(Category category, CategoryStatus new_status) { | 92 void FireCategoryStatusChanged(Category category, CategoryStatus new_status) { |
93 statuses_[category.id()] = new_status; | 93 statuses_[category.id()] = new_status; |
94 observer()->OnCategoryStatusChanged(this, category, new_status); | 94 observer()->OnCategoryStatusChanged(this, category, new_status); |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 497 |
498 EXPECT_THAT(service()->GetCategoryStatus(category), | 498 EXPECT_THAT(service()->GetCategoryStatus(category), |
499 Eq(CategoryStatus::NOT_PROVIDED)); | 499 Eq(CategoryStatus::NOT_PROVIDED)); |
500 EXPECT_TRUE(service()->GetCategories().empty()); | 500 EXPECT_TRUE(service()->GetCategories().empty()); |
501 ExpectThatSuggestionsAre(category, std::vector<int>()); | 501 ExpectThatSuggestionsAre(category, std::vector<int>()); |
502 | 502 |
503 service()->RemoveObserver(&observer); | 503 service()->RemoveObserver(&observer); |
504 } | 504 } |
505 | 505 |
506 } // namespace ntp_snippets | 506 } // namespace ntp_snippets |
OLD | NEW |