| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/ntp_snippets/content_suggestions_service.h" | 5 #include "components/ntp_snippets/content_suggestions_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 void CreateContentSuggestionsService( | 147 void CreateContentSuggestionsService( |
| 148 ContentSuggestionsService::State enabled) { | 148 ContentSuggestionsService::State enabled) { |
| 149 ASSERT_FALSE(service_); | 149 ASSERT_FALSE(service_); |
| 150 | 150 |
| 151 // TODO(jkrcal): Replace by a mock. | 151 // TODO(jkrcal): Replace by a mock. |
| 152 auto user_classifier = base::MakeUnique<UserClassifier>( | 152 auto user_classifier = base::MakeUnique<UserClassifier>( |
| 153 pref_service_.get(), base::MakeUnique<base::DefaultClock>()); | 153 pref_service_.get(), base::MakeUnique<base::DefaultClock>()); |
| 154 | 154 |
| 155 service_ = base::MakeUnique<ContentSuggestionsService>( | 155 service_ = base::MakeUnique<ContentSuggestionsService>( |
| 156 enabled, /*signin_manager=*/nullptr, /*history_service=*/nullptr, | 156 enabled, /*signin_manager=*/nullptr, /*history_service=*/nullptr, |
| 157 pref_service_.get(), std::move(category_ranker_), | 157 /*large_icon_service=*/nullptr, pref_service_.get(), |
| 158 std::move(user_classifier), /*scheduler=*/nullptr); | 158 std::move(category_ranker_), std::move(user_classifier), |
| 159 /*scheduler=*/nullptr); |
| 159 } | 160 } |
| 160 | 161 |
| 161 void ResetService() { | 162 void ResetService() { |
| 162 service_->Shutdown(); | 163 service_->Shutdown(); |
| 163 service_.reset(); | 164 service_.reset(); |
| 164 CreateContentSuggestionsService(ContentSuggestionsService::State::ENABLED); | 165 CreateContentSuggestionsService(ContentSuggestionsService::State::ENABLED); |
| 165 } | 166 } |
| 166 | 167 |
| 167 ContentSuggestionsService* service() { return service_.get(); } | 168 ContentSuggestionsService* service() { return service_.get(); } |
| 168 | 169 |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 Category category = Category::FromKnownCategory(KnownCategories::BOOKMARKS); | 808 Category category = Category::FromKnownCategory(KnownCategories::BOOKMARKS); |
| 808 MockContentSuggestionsProvider* provider = | 809 MockContentSuggestionsProvider* provider = |
| 809 MakeRegisteredMockProvider(category); | 810 MakeRegisteredMockProvider(category); |
| 810 provider->FireCategoryStatusChangedWithCurrentStatus(category); | 811 provider->FireCategoryStatusChangedWithCurrentStatus(category); |
| 811 | 812 |
| 812 EXPECT_CALL(*raw_mock_ranker, OnCategoryDismissed(category)); | 813 EXPECT_CALL(*raw_mock_ranker, OnCategoryDismissed(category)); |
| 813 service()->DismissCategory(category); | 814 service()->DismissCategory(category); |
| 814 } | 815 } |
| 815 | 816 |
| 816 } // namespace ntp_snippets | 817 } // namespace ntp_snippets |
| OLD | NEW |