| 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); | 78 ContentSuggestionsCardLayout::FULL_CARD, 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 Mock::VerifyAndClearExpectations(&observer); | 359 Mock::VerifyAndClearExpectations(&observer); |
| 360 | 360 |
| 361 // Shutdown the service | 361 // Shutdown the service |
| 362 EXPECT_CALL(observer, ContentSuggestionsServiceShutdown()); | 362 EXPECT_CALL(observer, ContentSuggestionsServiceShutdown()); |
| 363 service()->Shutdown(); | 363 service()->Shutdown(); |
| 364 service()->RemoveObserver(&observer); | 364 service()->RemoveObserver(&observer); |
| 365 // The service will receive two Shutdown() calls. | 365 // The service will receive two Shutdown() calls. |
| 366 } | 366 } |
| 367 | 367 |
| 368 } // namespace ntp_snippets | 368 } // namespace ntp_snippets |
| OLD | NEW |