1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_FAKE_SUGGESTIONS_PROVIDER_H_ 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_FAKE_SUGGESTIONS_PROVIDER_H_ 7 8 #include <vector> 9 #include "components/offline_pages/core/prefetch/suggestions_provider.h" 10 11 namespace offline_pages { 12 13 // A fake implementation of SuggestionsProvider for testing. 14 class FakeSuggestionsProvider : public SuggestionsProvider { 15 public: 16 FakeSuggestionsProvider(); 17 virtual ~FakeSuggestionsProvider(); 18 19 // Test methods. 20 void SetSuggestions(std::vector<PrefetchSuggestion> suggestions); report_article_list_viewed_count()21 int report_article_list_viewed_count() { 22 return report_article_list_viewed_count_; 23 } article_views()24 std::vector<GURL> article_views() { return article_views_; } 25 void ClearViews(); 26 27 // SuggestionsProvider implementation. 28 void GetCurrentArticleSuggestions( 29 SuggestionCallback suggestions_callback) override; 30 void ReportArticleListViewed() override; 31 void ReportArticleViewed(GURL article_url) override; 32 33 private: 34 std::vector<PrefetchSuggestion> suggestions_; 35 int report_article_list_viewed_count_ = 0; 36 std::vector<GURL> article_views_; 37 }; 38 39 } // namespace offline_pages 40 41 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_FAKE_SUGGESTIONS_PROVIDER_H_ 42