| Index: components/ntp_snippets/offline_pages/recent_tab_suggestions_provider_unittest.cc
|
| diff --git a/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider_unittest.cc b/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider_unittest.cc
|
| index 2688b518a116145681defc770dbfc367d41e0155..1d25e4a046004b70ec59d379e87f0888b6735420 100644
|
| --- a/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider_unittest.cc
|
| +++ b/components/ntp_snippets/offline_pages/recent_tab_suggestions_provider_unittest.cc
|
| @@ -9,14 +9,13 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/files/file_path.h"
|
| -#include "base/guid.h"
|
| #include "base/strings/string_number_conversions.h"
|
| -#include "base/strings/utf_string_conversions.h"
|
| #include "base/time/time.h"
|
| #include "components/ntp_snippets/category.h"
|
| #include "components/ntp_snippets/category_factory.h"
|
| #include "components/ntp_snippets/content_suggestions_provider.h"
|
| #include "components/ntp_snippets/mock_content_suggestions_provider_observer.h"
|
| +#include "components/ntp_snippets/offline_pages/offline_pages_test_utils.h"
|
| #include "components/offline_pages/client_namespace_constants.h"
|
| #include "components/offline_pages/offline_page_item.h"
|
| #include "components/offline_pages/stub_offline_page_model.h"
|
| @@ -24,6 +23,8 @@
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| +using ntp_snippets::test::CaptureDismissedSuggestions;
|
| +using ntp_snippets::test::FakeOfflinePageModel;
|
| using offline_pages::ClientId;
|
| using offline_pages::MultipleOfflinePageItemCallback;
|
| using offline_pages::OfflinePageItem;
|
| @@ -39,12 +40,7 @@ namespace ntp_snippets {
|
| namespace {
|
|
|
| OfflinePageItem CreateDummyRecentTab(int id) {
|
| - std::string strid = base::IntToString(id);
|
| - return OfflinePageItem(
|
| - GURL("http://dummy.com/" + strid), id,
|
| - ClientId(offline_pages::kLastNNamespace, base::GenerateGUID()),
|
| - base::FilePath::FromUTF8Unsafe("some/folder/test" + strid + ".mhtml"), 0,
|
| - base::Time::Now());
|
| + return test::CreateDummyOfflinePageItem(id, offline_pages::kLastNNamespace);
|
| }
|
|
|
| std::vector<OfflinePageItem> CreateDummyRecentTabs(
|
| @@ -62,33 +58,8 @@ OfflinePageItem CreateDummyRecentTab(int id, base::Time time) {
|
| return item;
|
| }
|
|
|
| -void CaptureDismissedSuggestions(
|
| - std::vector<ContentSuggestion>* captured_suggestions,
|
| - std::vector<ContentSuggestion> dismissed_suggestions) {
|
| - std::move(dismissed_suggestions.begin(), dismissed_suggestions.end(),
|
| - std::back_inserter(*captured_suggestions));
|
| -}
|
| -
|
| } // namespace
|
|
|
| -// This model is needed only when a provider is expected to call |GetAllPages|.
|
| -// In other cases, keeping this model empty ensures that provider listens to
|
| -// proxy notifications without calling |GetAllPages|.
|
| -class FakeOfflinePageModel : public StubOfflinePageModel {
|
| - public:
|
| - FakeOfflinePageModel() {}
|
| -
|
| - void GetAllPages(const MultipleOfflinePageItemCallback& callback) override {
|
| - callback.Run(items_);
|
| - }
|
| -
|
| - const std::vector<OfflinePageItem>& items() { return items_; }
|
| - std::vector<OfflinePageItem>* mutable_items() { return &items_; }
|
| -
|
| - private:
|
| - std::vector<OfflinePageItem> items_;
|
| -};
|
| -
|
| class RecentTabSuggestionsProviderTest : public testing::Test {
|
| public:
|
| RecentTabSuggestionsProviderTest()
|
|
|