Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: components/ntp_snippets/content_suggestions_service_unittest.cc

Issue 2260783002: Make GetDismissedSuggestionsForDebugging asynchronous (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace function pointer, use multiple if-continue Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
95 } 95 }
96 96
97 void FireSuggestionInvalidated(Category category, 97 void FireSuggestionInvalidated(Category category,
98 const std::string& suggestion_id) { 98 const std::string& suggestion_id) {
99 observer()->OnSuggestionInvalidated(this, category, suggestion_id); 99 observer()->OnSuggestionInvalidated(this, category, suggestion_id);
100 } 100 }
101 101
102 MOCK_METHOD1(ClearCachedSuggestionsForDebugging, void(Category category)); 102 MOCK_METHOD1(ClearCachedSuggestionsForDebugging, void(Category category));
103 MOCK_METHOD1(GetDismissedSuggestionsForDebugging, 103 MOCK_METHOD2(GetDismissedSuggestionsForDebugging,
104 std::vector<ContentSuggestion>(Category category)); 104 void(Category category,
105 const DismissedSuggestionsCallback& callback));
105 MOCK_METHOD1(ClearDismissedSuggestionsForDebugging, void(Category category)); 106 MOCK_METHOD1(ClearDismissedSuggestionsForDebugging, void(Category category));
106 MOCK_METHOD1(DismissSuggestion, void(const std::string& suggestion_id)); 107 MOCK_METHOD1(DismissSuggestion, void(const std::string& suggestion_id));
107 MOCK_METHOD2(FetchSuggestionImage, 108 MOCK_METHOD2(FetchSuggestionImage,
108 void(const std::string& suggestion_id, 109 void(const std::string& suggestion_id,
109 const ImageFetchedCallback& callback)); 110 const ImageFetchedCallback& callback));
110 111
111 private: 112 private:
112 std::vector<Category> provided_categories_; 113 std::vector<Category> provided_categories_;
113 std::map<int, CategoryStatus> statuses_; 114 std::map<int, CategoryStatus> statuses_;
114 }; 115 };
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 498
498 EXPECT_THAT(service()->GetCategoryStatus(category), 499 EXPECT_THAT(service()->GetCategoryStatus(category),
499 Eq(CategoryStatus::NOT_PROVIDED)); 500 Eq(CategoryStatus::NOT_PROVIDED));
500 EXPECT_TRUE(service()->GetCategories().empty()); 501 EXPECT_TRUE(service()->GetCategories().empty());
501 ExpectThatSuggestionsAre(category, std::vector<int>()); 502 ExpectThatSuggestionsAre(category, std::vector<int>());
502 503
503 service()->RemoveObserver(&observer); 504 service()->RemoveObserver(&observer);
504 } 505 }
505 506
506 } // namespace ntp_snippets 507 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/content_suggestions_service.cc ('k') | components/ntp_snippets/ntp_snippets_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698