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

Side by Side Diff: components/ntp_snippets/ios/reading_list_suggestions_provider_unittest.cc

Issue 2755113002: Create ReadingListSuggestionsProvider (Closed)
Patch Set: Address comments 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 unified diff | Download patch
OLDNEW
(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/ios/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>(
22 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.
23
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 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.
34
35 Category Category() {
36 return Category::FromKnownCategory(KnownCategories::READING_LIST);
37 }
38
39 private:
40 std::unique_ptr<ReadingListModelImpl> model_;
41 testing::StrictMock<MockContentSuggestionsProviderObserver> observer_;
42 std::unique_ptr<ReadingListSuggestionsProvider> provider_;
43 };
44
45 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.
46 CategoryInfo categoryInfo = Provider()->GetCategoryInfo(Category());
47 EXPECT_EQ(ContentSuggestionsAdditionalAction::VIEW_ALL,
48 categoryInfo.additional_action());
49 }
50
51 } // namespace
52 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698