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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 358 |
359 auto image_fetcher = base::MakeUnique<NiceMock<MockImageFetcher>>(); | 359 auto image_fetcher = base::MakeUnique<NiceMock<MockImageFetcher>>(); |
360 image_fetcher_ = image_fetcher.get(); | 360 image_fetcher_ = image_fetcher.get(); |
361 | 361 |
362 // Add an initial fetch response, as the service tries to fetch when there | 362 // Add an initial fetch response, as the service tries to fetch when there |
363 // is nothing in the DB. | 363 // is nothing in the DB. |
364 SetUpFetchResponse(GetTestJson(std::vector<std::string>())); | 364 SetUpFetchResponse(GetTestJson(std::vector<std::string>())); |
365 | 365 |
366 auto service = base::MakeUnique<NTPSnippetsService>( | 366 auto service = base::MakeUnique<NTPSnippetsService>( |
367 observer_.get(), &category_factory_, utils_.pref_service(), nullptr, | 367 observer_.get(), &category_factory_, utils_.pref_service(), nullptr, |
368 nullptr, "fr", &scheduler_, std::move(snippets_fetcher), | 368 "fr", &scheduler_, std::move(snippets_fetcher), |
369 std::move(image_fetcher), /*image_decoder=*/nullptr, | 369 std::move(image_fetcher), /*image_decoder=*/nullptr, |
370 base::MakeUnique<NTPSnippetsDatabase>(database_dir_.path(), | 370 base::MakeUnique<NTPSnippetsDatabase>(database_dir_.path(), |
371 task_runner), | 371 task_runner), |
372 base::MakeUnique<NTPSnippetsStatusService>(utils_.fake_signin_manager(), | 372 base::MakeUnique<NTPSnippetsStatusService>(utils_.fake_signin_manager(), |
373 utils_.pref_service())); | 373 utils_.pref_service())); |
374 | 374 |
375 base::RunLoop().RunUntilIdle(); | 375 base::RunLoop().RunUntilIdle(); |
376 observer_->WaitForLoad(); | 376 observer_->WaitForLoad(); |
377 return service; | 377 return service; |
378 } | 378 } |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 base::Time begin = base::Time::FromTimeT(123), | 883 base::Time begin = base::Time::FromTimeT(123), |
884 end = base::Time::FromTimeT(456); | 884 end = base::Time::FromTimeT(456); |
885 base::Callback<bool(const GURL& url)> filter; | 885 base::Callback<bool(const GURL& url)> filter; |
886 service->ClearHistory(begin, end, filter); | 886 service->ClearHistory(begin, end, filter); |
887 | 887 |
888 EXPECT_THAT(service->GetSnippetsForTesting(), IsEmpty()); | 888 EXPECT_THAT(service->GetSnippetsForTesting(), IsEmpty()); |
889 EXPECT_THAT(service->GetDismissedSnippetsForTesting(), IsEmpty()); | 889 EXPECT_THAT(service->GetDismissedSnippetsForTesting(), IsEmpty()); |
890 } | 890 } |
891 | 891 |
892 } // namespace ntp_snippets | 892 } // namespace ntp_snippets |
OLD | NEW |