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

Unified Diff: components/ntp_snippets/reading_list/reading_list_suggestions_provider_unittest.cc

Issue 2755113002: Create ReadingListSuggestionsProvider (Closed)
Patch Set: Move test to their target Created 3 years, 9 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/reading_list/reading_list_suggestions_provider_unittest.cc
diff --git a/components/ntp_snippets/reading_list/reading_list_suggestions_provider_unittest.cc b/components/ntp_snippets/reading_list/reading_list_suggestions_provider_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..23b0f8c267bc22c99016c708d5eb6ffabd408f5f
--- /dev/null
+++ b/components/ntp_snippets/reading_list/reading_list_suggestions_provider_unittest.cc
@@ -0,0 +1,50 @@
+// 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.
+
+#include "components/ntp_snippets/reading_list/reading_list_suggestions_provider.h"
+
+#include "base/memory/ptr_util.h"
+#include "base/test/simple_test_clock.h"
+#include "components/ntp_snippets/mock_content_suggestions_provider_observer.h"
+#include "components/reading_list/core/reading_list_model_impl.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace ntp_snippets {
+
+namespace {
+
+class ReadingListSuggestionsProviderTest : public ::testing::Test {
+ public:
+ ReadingListSuggestionsProviderTest() {
+ model_ = base::MakeUnique<ReadingListModelImpl>(
Marc Treib 2017/03/23 19:01:49 optional: If this is created in the ctor anyway, i
gambard 2017/03/24 09:08:51 The clock will be used in future tests.
+ /*storage_layer=*/nullptr, /*pref_service=*/nullptr,
+ base::MakeUnique<base::SimpleTestClock>());
+ EXPECT_CALL(observer_,
+ OnCategoryStatusChanged(testing::_, Category(),
+ CategoryStatus::AVAILABLE_LOADING))
+ .RetiresOnSaturation();
+
+ provider_ = base::MakeUnique<ReadingListSuggestionsProvider>(&observer_,
+ model_.get());
+ }
+
+ Category Category() {
Marc Treib 2017/03/23 19:01:49 nit: I find it confusing to overload the name betw
gambard 2017/03/24 09:08:51 Done.
+ return Category::FromKnownCategory(KnownCategories::READING_LIST);
+ }
+
+ protected:
+ std::unique_ptr<ReadingListModelImpl> model_;
+ testing::StrictMock<MockContentSuggestionsProviderObserver> observer_;
+ std::unique_ptr<ReadingListSuggestionsProvider> provider_;
+};
+
+TEST_F(ReadingListSuggestionsProviderTest, CategoryInfo) {
+ CategoryInfo categoryInfo = provider_->GetCategoryInfo(Category());
+ EXPECT_EQ(ContentSuggestionsAdditionalAction::VIEW_ALL,
+ categoryInfo.additional_action());
+}
+
+} // namespace
+} // namespace ntp_snippets

Powered by Google App Engine
This is Rietveld 408576698