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

Unified Diff: components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc

Issue 2618243004: Add a unit test for the BookmarkSuggestionsProvider. (Closed)
Patch Set: renamed MockProvider and updated tests comments about expected behavior Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_snippets/mock_content_suggestions_provider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
index a2767730bbdd0dfcab5ce4c333176788e106500c..af4ccc8e1dcc2d8e70031915e8ce2b620f0a93ed 100644
--- a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
+++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc
@@ -31,6 +31,7 @@
#include "components/ntp_snippets/category_rankers/category_ranker.h"
#include "components/ntp_snippets/category_rankers/constant_category_ranker.h"
#include "components/ntp_snippets/category_rankers/mock_category_ranker.h"
+#include "components/ntp_snippets/fake_content_suggestions_provider_observer.h"
#include "components/ntp_snippets/ntp_snippets_constants.h"
#include "components/ntp_snippets/pref_names.h"
#include "components/ntp_snippets/remote/ntp_snippet.h"
@@ -343,51 +344,6 @@ class MockImageFetcher : public ImageFetcher {
base::Callback<void(const std::string&, const gfx::Image&)>));
};
-class FakeContentSuggestionsProviderObserver
- : public ContentSuggestionsProvider::Observer {
- public:
- FakeContentSuggestionsProviderObserver() = default;
-
- void OnNewSuggestions(ContentSuggestionsProvider* provider,
- Category category,
- std::vector<ContentSuggestion> suggestions) override {
- suggestions_[category] = std::move(suggestions);
- }
-
- void OnCategoryStatusChanged(ContentSuggestionsProvider* provider,
- Category category,
- CategoryStatus new_status) override {
- statuses_[category] = new_status;
- }
-
- void OnSuggestionInvalidated(
- ContentSuggestionsProvider* provider,
- const ContentSuggestion::ID& suggestion_id) override {}
-
- const std::map<Category, CategoryStatus, Category::CompareByID>& statuses()
- const {
- return statuses_;
- }
-
- CategoryStatus StatusForCategory(Category category) const {
- auto it = statuses_.find(category);
- EXPECT_THAT(it, Not(Eq(statuses_.end())));
- return it->second;
- }
-
- const std::vector<ContentSuggestion>& SuggestionsForCategory(
- Category category) {
- return suggestions_[category];
- }
-
- private:
- std::map<Category, CategoryStatus, Category::CompareByID> statuses_;
- std::map<Category, std::vector<ContentSuggestion>, Category::CompareByID>
- suggestions_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeContentSuggestionsProviderObserver);
-};
-
class FakeImageDecoder : public image_fetcher::ImageDecoder {
public:
FakeImageDecoder() {}
« no previous file with comments | « components/ntp_snippets/mock_content_suggestions_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698