| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ntp_snippets_service.h" | 5 #include "components/ntp_snippets/ntp_snippets_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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 image_fetcher_ = image_fetcher.get(); | 391 image_fetcher_ = image_fetcher.get(); |
| 392 | 392 |
| 393 // Add an initial fetch response, as the service tries to fetch when there | 393 // Add an initial fetch response, as the service tries to fetch when there |
| 394 // is nothing in the DB. | 394 // is nothing in the DB. |
| 395 SetUpFetchResponse(GetTestJson(std::vector<std::string>())); | 395 SetUpFetchResponse(GetTestJson(std::vector<std::string>())); |
| 396 | 396 |
| 397 auto service = base::MakeUnique<NTPSnippetsService>( | 397 auto service = base::MakeUnique<NTPSnippetsService>( |
| 398 observer_.get(), &category_factory_, utils_.pref_service(), nullptr, | 398 observer_.get(), &category_factory_, utils_.pref_service(), nullptr, |
| 399 "fr", &scheduler_, std::move(snippets_fetcher), | 399 "fr", &scheduler_, std::move(snippets_fetcher), |
| 400 std::move(image_fetcher), /*image_decoder=*/nullptr, | 400 std::move(image_fetcher), /*image_decoder=*/nullptr, |
| 401 base::MakeUnique<NTPSnippetsDatabase>(database_dir_.path(), | 401 base::MakeUnique<NTPSnippetsDatabase>(database_dir_.GetPath(), |
| 402 task_runner), | 402 task_runner), |
| 403 base::MakeUnique<NTPSnippetsStatusService>(utils_.fake_signin_manager(), | 403 base::MakeUnique<NTPSnippetsStatusService>(utils_.fake_signin_manager(), |
| 404 utils_.pref_service())); | 404 utils_.pref_service())); |
| 405 | 405 |
| 406 base::RunLoop().RunUntilIdle(); | 406 base::RunLoop().RunUntilIdle(); |
| 407 observer_->WaitForLoad(); | 407 observer_->WaitForLoad(); |
| 408 return service; | 408 return service; |
| 409 } | 409 } |
| 410 | 410 |
| 411 void ResetSnippetsService(std::unique_ptr<NTPSnippetsService>* service) { | 411 void ResetSnippetsService(std::unique_ptr<NTPSnippetsService>* service) { |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 end = base::Time::FromTimeT(456); | 976 end = base::Time::FromTimeT(456); |
| 977 base::Callback<bool(const GURL& url)> filter; | 977 base::Callback<bool(const GURL& url)> filter; |
| 978 service->ClearHistory(begin, end, filter); | 978 service->ClearHistory(begin, end, filter); |
| 979 | 979 |
| 980 EXPECT_THAT(service->GetSnippetsForTesting(articles_category()), IsEmpty()); | 980 EXPECT_THAT(service->GetSnippetsForTesting(articles_category()), IsEmpty()); |
| 981 EXPECT_THAT(service->GetDismissedSnippetsForTesting(articles_category()), | 981 EXPECT_THAT(service->GetDismissedSnippetsForTesting(articles_category()), |
| 982 IsEmpty()); | 982 IsEmpty()); |
| 983 } | 983 } |
| 984 | 984 |
| 985 } // namespace ntp_snippets | 985 } // namespace ntp_snippets |
| OLD | NEW |