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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 scoped_refptr<base::SingleThreadTaskRunner> task_runner( | 411 scoped_refptr<base::SingleThreadTaskRunner> task_runner( |
412 base::ThreadTaskRunnerHandle::Get()); | 412 base::ThreadTaskRunnerHandle::Get()); |
413 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = | 413 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = |
414 new net::TestURLRequestContextGetter(task_runner.get()); | 414 new net::TestURLRequestContextGetter(task_runner.get()); |
415 | 415 |
416 utils_.ResetSigninManager(); | 416 utils_.ResetSigninManager(); |
417 std::unique_ptr<NTPSnippetsFetcher> snippets_fetcher = | 417 std::unique_ptr<NTPSnippetsFetcher> snippets_fetcher = |
418 base::MakeUnique<NTPSnippetsFetcher>( | 418 base::MakeUnique<NTPSnippetsFetcher>( |
419 utils_.fake_signin_manager(), fake_token_service_.get(), | 419 utils_.fake_signin_manager(), fake_token_service_.get(), |
420 std::move(request_context_getter), utils_.pref_service(), | 420 std::move(request_context_getter), utils_.pref_service(), |
421 &category_factory_, nullptr, base::Bind(&ParseJson), kAPIKey); | 421 &category_factory_, nullptr, base::Bind(&ParseJson), kAPIKey, |
| 422 &user_classifier_); |
422 | 423 |
423 utils_.fake_signin_manager()->SignIn("foo@bar.com"); | 424 utils_.fake_signin_manager()->SignIn("foo@bar.com"); |
424 snippets_fetcher->SetPersonalizationForTesting( | 425 snippets_fetcher->SetPersonalizationForTesting( |
425 NTPSnippetsFetcher::Personalization::kNonPersonal); | 426 NTPSnippetsFetcher::Personalization::kNonPersonal); |
426 | 427 |
427 auto image_fetcher = base::MakeUnique<NiceMock<MockImageFetcher>>(); | 428 auto image_fetcher = base::MakeUnique<NiceMock<MockImageFetcher>>(); |
428 | 429 |
429 image_fetcher_ = image_fetcher.get(); | 430 image_fetcher_ = image_fetcher.get(); |
430 EXPECT_CALL(*image_fetcher, SetImageFetcherDelegate(_)); | 431 EXPECT_CALL(*image_fetcher, SetImageFetcherDelegate(_)); |
431 auto image_decoder = base::MakeUnique<FakeImageDecoder>(); | 432 auto image_decoder = base::MakeUnique<FakeImageDecoder>(); |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 base::StringPrintf("http://localhost/snippet-id-%d", i))); | 1231 base::StringPrintf("http://localhost/snippet-id-%d", i))); |
1231 } | 1232 } |
1232 LoadFromJSONString(service.get(), GetTestJson(suggestions)); | 1233 LoadFromJSONString(service.get(), GetTestJson(suggestions)); |
1233 // TODO(tschumann): We should probably trim out any additional results and | 1234 // TODO(tschumann): We should probably trim out any additional results and |
1234 // only serve the MaxSnippetCount items. | 1235 // only serve the MaxSnippetCount items. |
1235 EXPECT_THAT(service->GetSnippetsForTesting(articles_category()), | 1236 EXPECT_THAT(service->GetSnippetsForTesting(articles_category()), |
1236 SizeIs(service->GetMaxSnippetCountForTesting() + 1)); | 1237 SizeIs(service->GetMaxSnippetCountForTesting() + 1)); |
1237 } | 1238 } |
1238 | 1239 |
1239 } // namespace ntp_snippets | 1240 } // namespace ntp_snippets |
OLD | NEW |