Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: components/ntp_snippets/remote/ntp_snippets_service_unittest.cc

Issue 2395123002: Connecting UserClassifier to NtpSnippetsFetcher (Closed)
Patch Set: A small fix Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 scoped_refptr<base::SingleThreadTaskRunner> task_runner( 381 scoped_refptr<base::SingleThreadTaskRunner> task_runner(
382 base::ThreadTaskRunnerHandle::Get()); 382 base::ThreadTaskRunnerHandle::Get());
383 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = 383 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter =
384 new net::TestURLRequestContextGetter(task_runner.get()); 384 new net::TestURLRequestContextGetter(task_runner.get());
385 385
386 utils_.ResetSigninManager(); 386 utils_.ResetSigninManager();
387 std::unique_ptr<NTPSnippetsFetcher> snippets_fetcher = 387 std::unique_ptr<NTPSnippetsFetcher> snippets_fetcher =
388 base::MakeUnique<NTPSnippetsFetcher>( 388 base::MakeUnique<NTPSnippetsFetcher>(
389 utils_.fake_signin_manager(), fake_token_service_.get(), 389 utils_.fake_signin_manager(), fake_token_service_.get(),
390 std::move(request_context_getter), utils_.pref_service(), 390 std::move(request_context_getter), utils_.pref_service(),
391 &category_factory_, base::Bind(&ParseJson), kAPIKey); 391 &category_factory_, base::Bind(&ParseJson), kAPIKey,
392 &user_classifier_);
392 393
393 utils_.fake_signin_manager()->SignIn("foo@bar.com"); 394 utils_.fake_signin_manager()->SignIn("foo@bar.com");
394 snippets_fetcher->SetPersonalizationForTesting( 395 snippets_fetcher->SetPersonalizationForTesting(
395 NTPSnippetsFetcher::Personalization::kNonPersonal); 396 NTPSnippetsFetcher::Personalization::kNonPersonal);
396 397
397 auto image_fetcher = base::MakeUnique<NiceMock<MockImageFetcher>>(); 398 auto image_fetcher = base::MakeUnique<NiceMock<MockImageFetcher>>();
398 image_fetcher_ = image_fetcher.get(); 399 image_fetcher_ = image_fetcher.get();
399 EXPECT_FALSE(observer_); 400 EXPECT_FALSE(observer_);
400 observer_ = base::MakeUnique<FakeContentSuggestionsProviderObserver>(); 401 observer_ = base::MakeUnique<FakeContentSuggestionsProviderObserver>();
401 return base::MakeUnique<NTPSnippetsService>( 402 return base::MakeUnique<NTPSnippetsService>(
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 1097
1097 // Sign in to check a transition from signed out to signed in. 1098 // Sign in to check a transition from signed out to signed in.
1098 SetUpFetchResponse(GetTestJson({GetSnippetN(1), GetSnippetN(2)})); 1099 SetUpFetchResponse(GetTestJson({GetSnippetN(1), GetSnippetN(2)}));
1099 service->OnSnippetsStatusChanged(SnippetsStatus::ENABLED_AND_SIGNED_OUT, 1100 service->OnSnippetsStatusChanged(SnippetsStatus::ENABLED_AND_SIGNED_OUT,
1100 SnippetsStatus::ENABLED_AND_SIGNED_IN); 1101 SnippetsStatus::ENABLED_AND_SIGNED_IN);
1101 base::RunLoop().RunUntilIdle(); 1102 base::RunLoop().RunUntilIdle();
1102 EXPECT_THAT(service->GetSnippetsForTesting(articles_category()), SizeIs(2)); 1103 EXPECT_THAT(service->GetSnippetsForTesting(articles_category()), SizeIs(2));
1103 } 1104 }
1104 1105
1105 } // namespace ntp_snippets 1106 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698