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_ |