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/remote/ntp_snippets_service.h" | 5 #include "components/ntp_snippets/remote/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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 scoped_refptr<base::SingleThreadTaskRunner> task_runner( | 399 scoped_refptr<base::SingleThreadTaskRunner> task_runner( |
400 base::ThreadTaskRunnerHandle::Get()); | 400 base::ThreadTaskRunnerHandle::Get()); |
401 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = | 401 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = |
402 new net::TestURLRequestContextGetter(task_runner.get()); | 402 new net::TestURLRequestContextGetter(task_runner.get()); |
403 | 403 |
404 utils_.ResetSigninManager(); | 404 utils_.ResetSigninManager(); |
405 std::unique_ptr<NTPSnippetsFetcher> snippets_fetcher = | 405 std::unique_ptr<NTPSnippetsFetcher> snippets_fetcher = |
406 base::MakeUnique<NTPSnippetsFetcher>( | 406 base::MakeUnique<NTPSnippetsFetcher>( |
407 utils_.fake_signin_manager(), fake_token_service_.get(), | 407 utils_.fake_signin_manager(), fake_token_service_.get(), |
408 std::move(request_context_getter), utils_.pref_service(), | 408 std::move(request_context_getter), utils_.pref_service(), |
409 &category_factory_, base::Bind(&ParseJson), kAPIKey); | 409 &category_factory_, nullptr, base::Bind(&ParseJson), kAPIKey); |
410 | 410 |
411 utils_.fake_signin_manager()->SignIn("foo@bar.com"); | 411 utils_.fake_signin_manager()->SignIn("foo@bar.com"); |
412 snippets_fetcher->SetPersonalizationForTesting( | 412 snippets_fetcher->SetPersonalizationForTesting( |
413 NTPSnippetsFetcher::Personalization::kNonPersonal); | 413 NTPSnippetsFetcher::Personalization::kNonPersonal); |
414 | 414 |
415 auto image_fetcher = base::MakeUnique<NiceMock<MockImageFetcher>>(); | 415 auto image_fetcher = base::MakeUnique<NiceMock<MockImageFetcher>>(); |
416 | 416 |
417 image_fetcher_ = image_fetcher.get(); | 417 image_fetcher_ = image_fetcher.get(); |
418 EXPECT_CALL(*image_fetcher, SetImageFetcherDelegate(_)); | 418 EXPECT_CALL(*image_fetcher, SetImageFetcherDelegate(_)); |
419 auto image_decoder = base::MakeUnique<FakeImageDecoder>(); | 419 auto image_decoder = base::MakeUnique<FakeImageDecoder>(); |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 base::StringPrintf("http://localhost/snippet-id-%d", i))); | 1181 base::StringPrintf("http://localhost/snippet-id-%d", i))); |
1182 } | 1182 } |
1183 LoadFromJSONString(service.get(), GetTestJson(suggestions)); | 1183 LoadFromJSONString(service.get(), GetTestJson(suggestions)); |
1184 // TODO(tschumann): We should probably trim out any additional results and | 1184 // TODO(tschumann): We should probably trim out any additional results and |
1185 // only serve the MaxSnippetCount items. | 1185 // only serve the MaxSnippetCount items. |
1186 EXPECT_THAT(service->GetSnippetsForTesting(articles_category()), | 1186 EXPECT_THAT(service->GetSnippetsForTesting(articles_category()), |
1187 SizeIs(service->GetMaxSnippetCountForTesting() + 1)); | 1187 SizeIs(service->GetMaxSnippetCountForTesting() + 1)); |
1188 } | 1188 } |
1189 | 1189 |
1190 } // namespace ntp_snippets | 1190 } // namespace ntp_snippets |
OLD | NEW |