Chromium Code Reviews| Index: components/ntp_snippets/ios/reading_list_suggestions_provider_unittest.cc |
| diff --git a/components/ntp_snippets/ios/reading_list_suggestions_provider_unittest.cc b/components/ntp_snippets/ios/reading_list_suggestions_provider_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0979c4afbe8573fdf424b9a02a8edecad1f251f5 |
| --- /dev/null |
| +++ b/components/ntp_snippets/ios/reading_list_suggestions_provider_unittest.cc |
| @@ -0,0 +1,52 @@ |
| +// 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/ios/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>( |
| + nullptr, nullptr, base::MakeUnique<base::SimpleTestClock>()); |
|
Marc Treib
2017/03/23 17:12:21
nit: Add /*the_thing=*/nullptr comments?
gambard
2017/03/23 17:49:39
Done.
|
| + |
| + EXPECT_CALL(observer_, |
| + OnCategoryStatusChanged(testing::_, Category(), |
| + CategoryStatus::AVAILABLE_LOADING)) |
| + .RetiresOnSaturation(); |
| + |
| + provider_ = base::MakeUnique<ReadingListSuggestionsProvider>(&observer_, |
| + model_.get()); |
| + } |
| + |
| + ReadingListSuggestionsProvider* Provider() { return provider_.get(); } |
|
Marc Treib
2017/03/23 17:12:21
nit: either "provider" or "GetProvider"
gambard
2017/03/23 17:49:39
Done.
|
| + |
| + Category Category() { |
| + return Category::FromKnownCategory(KnownCategories::READING_LIST); |
| + } |
| + |
| + private: |
| + std::unique_ptr<ReadingListModelImpl> model_; |
| + testing::StrictMock<MockContentSuggestionsProviderObserver> observer_; |
| + std::unique_ptr<ReadingListSuggestionsProvider> provider_; |
| +}; |
| + |
| +TEST_F(ReadingListSuggestionsProviderTest, testCategoryInfo) { |
|
gambard
2017/03/23 15:45:52
This is not doing much for now, but it allows othe
Marc Treib
2017/03/23 17:12:21
nitty nit: test names are usually UpperCamel, and
gambard
2017/03/23 17:49:39
Done.
|
| + CategoryInfo categoryInfo = Provider()->GetCategoryInfo(Category()); |
| + EXPECT_EQ(ContentSuggestionsAdditionalAction::VIEW_ALL, |
| + categoryInfo.additional_action()); |
| +} |
| + |
| +} // namespace |
| +} // namespace ntp_snippets |