| 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_METHOD0(ClearCachedSuggestionsForDebugging, void()); | 83 MOCK_METHOD1(ClearCachedSuggestionsForDebugging, void(Category category)); |
| 84 MOCK_METHOD0(ClearDismissedSuggestionsForDebugging, void()); | 84 MOCK_METHOD1(GetDismissedSuggestionsForDebugging, |
| 85 std::vector<ContentSuggestion>(Category category)); |
| 86 MOCK_METHOD1(ClearDismissedSuggestionsForDebugging, void(Category category)); |
| 85 MOCK_METHOD1(DismissSuggestion, void(const std::string& suggestion_id)); | 87 MOCK_METHOD1(DismissSuggestion, void(const std::string& suggestion_id)); |
| 86 MOCK_METHOD2(FetchSuggestionImage, | 88 MOCK_METHOD2(FetchSuggestionImage, |
| 87 void(const std::string& suggestion_id, | 89 void(const std::string& suggestion_id, |
| 88 const ImageFetchedCallback& callback)); | 90 const ImageFetchedCallback& callback)); |
| 89 | 91 |
| 90 private: | 92 private: |
| 91 std::vector<Category> provided_categories_; | 93 std::vector<Category> provided_categories_; |
| 92 std::map<int, CategoryStatus> statuses_; | 94 std::map<int, CategoryStatus> statuses_; |
| 93 }; | 95 }; |
| 94 | 96 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 Mock::VerifyAndClearExpectations(&observer); | 352 Mock::VerifyAndClearExpectations(&observer); |
| 351 | 353 |
| 352 // Shutdown the service | 354 // Shutdown the service |
| 353 EXPECT_CALL(observer, ContentSuggestionsServiceShutdown()); | 355 EXPECT_CALL(observer, ContentSuggestionsServiceShutdown()); |
| 354 service()->Shutdown(); | 356 service()->Shutdown(); |
| 355 service()->RemoveObserver(&observer); | 357 service()->RemoveObserver(&observer); |
| 356 // The service will receive two Shutdown() calls. | 358 // The service will receive two Shutdown() calls. |
| 357 } | 359 } |
| 358 | 360 |
| 359 } // namespace ntp_snippets | 361 } // namespace ntp_snippets |
| OLD | NEW |