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

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

Issue 2400133002: Sending LanguageModel info to suggestions server (Closed)
Patch Set: Small fixes 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 GetTestJson({GetSnippetWithUrl( 1166 GetTestJson({GetSnippetWithUrl(
1167 "http://something.com/pletely/unrelated")})); 1167 "http://something.com/pletely/unrelated")}));
1168 // The image should still be available until a restart happens. 1168 // The image should still be available until a restart happens.
1169 EXPECT_FALSE(FetchImage(service.get(), MakeArticleID(kSnippetUrl)).IsEmpty()); 1169 EXPECT_FALSE(FetchImage(service.get(), MakeArticleID(kSnippetUrl)).IsEmpty());
1170 ResetSnippetsService(&service); 1170 ResetSnippetsService(&service);
1171 // After the restart, the image should be garbage collected. 1171 // After the restart, the image should be garbage collected.
1172 EXPECT_TRUE(FetchImage(service.get(), MakeArticleID(kSnippetUrl)).IsEmpty()); 1172 EXPECT_TRUE(FetchImage(service.get(), MakeArticleID(kSnippetUrl)).IsEmpty());
1173 } 1173 }
1174 1174
1175 } // namespace ntp_snippets 1175 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698