Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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 #include "components/ntp_snippets/reading_list/reading_list_suggestions_provider .h" | |
| 6 | |
| 7 #include "base/memory/ptr_util.h" | |
| 8 #include "base/test/simple_test_clock.h" | |
| 9 #include "components/ntp_snippets/mock_content_suggestions_provider_observer.h" | |
| 10 #include "components/reading_list/core/reading_list_model_impl.h" | |
| 11 #include "testing/gmock/include/gmock/gmock.h" | |
| 12 #include "testing/gtest/include/gtest/gtest.h" | |
| 13 | |
| 14 namespace ntp_snippets { | |
| 15 | |
| 16 namespace { | |
| 17 | |
| 18 class ReadingListSuggestionsProviderTest : public ::testing::Test { | |
| 19 public: | |
| 20 ReadingListSuggestionsProviderTest() { | |
| 21 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.
| |
| 22 /*storage_layer=*/nullptr, /*pref_service=*/nullptr, | |
| 23 base::MakeUnique<base::SimpleTestClock>()); | |
| 24 EXPECT_CALL(observer_, | |
| 25 OnCategoryStatusChanged(testing::_, Category(), | |
| 26 CategoryStatus::AVAILABLE_LOADING)) | |
| 27 .RetiresOnSaturation(); | |
| 28 | |
| 29 provider_ = base::MakeUnique<ReadingListSuggestionsProvider>(&observer_, | |
| 30 model_.get()); | |
| 31 } | |
| 32 | |
| 33 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.
| |
| 34 return Category::FromKnownCategory(KnownCategories::READING_LIST); | |
| 35 } | |
| 36 | |
| 37 protected: | |
| 38 std::unique_ptr<ReadingListModelImpl> model_; | |
| 39 testing::StrictMock<MockContentSuggestionsProviderObserver> observer_; | |
| 40 std::unique_ptr<ReadingListSuggestionsProvider> provider_; | |
| 41 }; | |
| 42 | |
| 43 TEST_F(ReadingListSuggestionsProviderTest, CategoryInfo) { | |
| 44 CategoryInfo categoryInfo = provider_->GetCategoryInfo(Category()); | |
| 45 EXPECT_EQ(ContentSuggestionsAdditionalAction::VIEW_ALL, | |
| 46 categoryInfo.additional_action()); | |
| 47 } | |
| 48 | |
| 49 } // namespace | |
| 50 } // namespace ntp_snippets | |
| OLD | NEW |