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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 std::vector<Category> GetProvidedCategories() override { | 68 std::vector<Category> GetProvidedCategories() override { |
69 return provided_categories_; | 69 return provided_categories_; |
70 } | 70 } |
71 | 71 |
72 CategoryStatus GetCategoryStatus(Category category) { | 72 CategoryStatus GetCategoryStatus(Category category) { |
73 return statuses_[category.id()]; | 73 return statuses_[category.id()]; |
74 } | 74 } |
75 | 75 |
76 CategoryInfo GetCategoryInfo(Category category) { | 76 CategoryInfo GetCategoryInfo(Category category) { |
77 return CategoryInfo(base::ASCIIToUTF16("Section title"), | 77 return CategoryInfo(base::ASCIIToUTF16("Section title"), |
78 ContentSuggestionsCardLayout::FULL_CARD, true); | 78 ContentSuggestionsCardLayout::FULL_CARD, true, true); |
79 } | 79 } |
80 | 80 |
81 void FireSuggestionsChanged(Category category, std::vector<int> numbers) { | 81 void FireSuggestionsChanged(Category category, std::vector<int> numbers) { |
82 observer()->OnNewSuggestions(this, category, CreateSuggestions(numbers)); | 82 observer()->OnNewSuggestions(this, category, CreateSuggestions(numbers)); |
83 } | 83 } |
84 | 84 |
85 void FireCategoryStatusChanged(Category category, CategoryStatus new_status) { | 85 void FireCategoryStatusChanged(Category category, CategoryStatus new_status) { |
86 statuses_[category.id()] = new_status; | 86 statuses_[category.id()] = new_status; |
87 observer()->OnCategoryStatusChanged(this, category, new_status); | 87 observer()->OnCategoryStatusChanged(this, category, new_status); |
88 } | 88 } |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 Mock::VerifyAndClearExpectations(&observer); | 357 Mock::VerifyAndClearExpectations(&observer); |
358 | 358 |
359 // Shutdown the service | 359 // Shutdown the service |
360 EXPECT_CALL(observer, ContentSuggestionsServiceShutdown()); | 360 EXPECT_CALL(observer, ContentSuggestionsServiceShutdown()); |
361 service()->Shutdown(); | 361 service()->Shutdown(); |
362 service()->RemoveObserver(&observer); | 362 service()->RemoveObserver(&observer); |
363 // The service will receive two Shutdown() calls. | 363 // The service will receive two Shutdown() calls. |
364 } | 364 } |
365 | 365 |
366 } // namespace ntp_snippets | 366 } // namespace ntp_snippets |
OLD | NEW |