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

Unified Diff: components/ntp_snippets/fake_content_suggestions_provider_observer.h

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
Index: components/ntp_snippets/fake_content_suggestions_provider_observer.h
diff --git a/components/ntp_snippets/fake_content_suggestions_provider_observer.h b/components/ntp_snippets/fake_content_suggestions_provider_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..60ff2bf48a66aa07a9a420d46898178b7d357d26
--- /dev/null
+++ b/components/ntp_snippets/fake_content_suggestions_provider_observer.h
@@ -0,0 +1,54 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_NTP_SNIPPETS_FAKE_CONTENT_SUGGESTIONS_PROVIDER_OBSERVER_H_
+#define COMPONENTS_NTP_SNIPPETS_FAKE_CONTENT_SUGGESTIONS_PROVIDER_OBSERVER_H_
+
+#include <map>
+#include <vector>
+
+#include "base/macros.h"
+#include "components/ntp_snippets/category.h"
+#include "components/ntp_snippets/content_suggestion.h"
+#include "components/ntp_snippets/content_suggestions_provider.h"
+
+namespace ntp_snippets {
+
+class FakeContentSuggestionsProviderObserver
+ : public ContentSuggestionsProvider::Observer {
+ public:
+ FakeContentSuggestionsProviderObserver();
+ ~FakeContentSuggestionsProviderObserver();
+
+ void OnNewSuggestions(ContentSuggestionsProvider* provider,
+ Category category,
+ std::vector<ContentSuggestion> suggestions) override;
+
+ void OnCategoryStatusChanged(ContentSuggestionsProvider* provider,
+ Category category,
+ CategoryStatus new_status) override;
+
+ void OnSuggestionInvalidated(
+ ContentSuggestionsProvider* provider,
+ const ContentSuggestion::ID& suggestion_id) override;
+
+ const std::map<Category, CategoryStatus, Category::CompareByID>& statuses()
+ const;
+
+ CategoryStatus StatusForCategory(Category category) const;
+
+ const std::vector<ContentSuggestion>& SuggestionsForCategory(
+ Category category);
+
+ private:
+ std::map<Category, CategoryStatus, Category::CompareByID> statuses_;
+ std::map<Category, std::vector<ContentSuggestion>, Category::CompareByID>
+ suggestions_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeContentSuggestionsProviderObserver);
+};
+
+} // namespace ntp_snippets
+
+#endif // COMPONENTS_NTP_SNIPPETS_FAKE_CONTENT_SUGGESTIONS_PROVIDER_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698