| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 void FireSuggestionsChanged(Category category, std::vector<int> numbers) { | 74 void FireSuggestionsChanged(Category category, std::vector<int> numbers) { |
| 75 observer()->OnNewSuggestions(this, category, CreateSuggestions(numbers)); | 75 observer()->OnNewSuggestions(this, category, CreateSuggestions(numbers)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void FireCategoryStatusChanged(Category category, CategoryStatus new_status) { | 78 void FireCategoryStatusChanged(Category category, CategoryStatus new_status) { |
| 79 statuses_[category.id()] = new_status; | 79 statuses_[category.id()] = new_status; |
| 80 observer()->OnCategoryStatusChanged(this, category, new_status); | 80 observer()->OnCategoryStatusChanged(this, category, new_status); |
| 81 } | 81 } |
| 82 | 82 |
| 83 MOCK_METHOD1(ClearCachedSuggestionsForDebugging, void(Category category)); | 83 MOCK_METHOD0(ClearCachedSuggestionsForDebugging, void()); |
| 84 MOCK_METHOD1(GetDismissedSuggestionsForDebugging, | 84 MOCK_METHOD0(ClearDismissedSuggestionsForDebugging, void()); |
| 85 std::vector<ContentSuggestion>(Category category)); | |
| 86 MOCK_METHOD1(ClearDismissedSuggestionsForDebugging, void(Category category)); | |
| 87 MOCK_METHOD1(DismissSuggestion, void(const std::string& suggestion_id)); | 85 MOCK_METHOD1(DismissSuggestion, void(const std::string& suggestion_id)); |
| 88 MOCK_METHOD2(FetchSuggestionImage, | 86 MOCK_METHOD2(FetchSuggestionImage, |
| 89 void(const std::string& suggestion_id, | 87 void(const std::string& suggestion_id, |
| 90 const ImageFetchedCallback& callback)); | 88 const ImageFetchedCallback& callback)); |
| 91 | 89 |
| 92 private: | 90 private: |
| 93 std::vector<Category> provided_categories_; | 91 std::vector<Category> provided_categories_; |
| 94 std::map<int, CategoryStatus> statuses_; | 92 std::map<int, CategoryStatus> statuses_; |
| 95 }; | 93 }; |
| 96 | 94 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 Mock::VerifyAndClearExpectations(&observer); | 350 Mock::VerifyAndClearExpectations(&observer); |
| 353 | 351 |
| 354 // Shutdown the service | 352 // Shutdown the service |
| 355 EXPECT_CALL(observer, ContentSuggestionsServiceShutdown()); | 353 EXPECT_CALL(observer, ContentSuggestionsServiceShutdown()); |
| 356 service()->Shutdown(); | 354 service()->Shutdown(); |
| 357 service()->RemoveObserver(&observer); | 355 service()->RemoveObserver(&observer); |
| 358 // The service will receive two Shutdown() calls. | 356 // The service will receive two Shutdown() calls. |
| 359 } | 357 } |
| 360 | 358 |
| 361 } // namespace ntp_snippets | 359 } // namespace ntp_snippets |
| OLD | NEW |