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

Unified Diff: components/ntp_snippets/ntp_snippets_service_unittest.cc

Issue 2162533002: Adding a request counter to the snippets fetcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@traffic-monitor
Patch Set: Bernhard's comments Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_snippets/ntp_snippets_service.cc ('k') | components/ntp_snippets/request_throttler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/ntp_snippets_service_unittest.cc
diff --git a/components/ntp_snippets/ntp_snippets_service_unittest.cc b/components/ntp_snippets/ntp_snippets_service_unittest.cc
index b5019c9c19373b90d379403fe53027f28ee8e32f..f7887a3756d4696f556b09997f286c6115282381 100644
--- a/components/ntp_snippets/ntp_snippets_service_unittest.cc
+++ b/components/ntp_snippets/ntp_snippets_service_unittest.cc
@@ -269,6 +269,7 @@ class NTPSnippetsServiceTest : public test::NTPSnippetsTestBase {
test_url_(base::StringPrintf(kTestContentSnippetsServerFormat,
google_apis::GetAPIKey().c_str())) {
NTPSnippetsService::RegisterProfilePrefs(pref_service()->registry());
+ RequestThrottler::RegisterProfilePrefs(pref_service()->registry());
// Since no SuggestionsService is injected in tests, we need to force the
// service to fetch from all hosts.
@@ -311,7 +312,8 @@ class NTPSnippetsServiceTest : public test::NTPSnippetsTestBase {
std::unique_ptr<NTPSnippetsFetcher> snippets_fetcher =
base::MakeUnique<NTPSnippetsFetcher>(
fake_signin_manager(), fake_token_service_.get(),
- std::move(request_context_getter), base::Bind(&ParseJson),
+ std::move(request_context_getter), pref_service(),
+ base::Bind(&ParseJson),
/*is_stable_channel=*/true);
fake_signin_manager()->SignIn("foo@bar.com");
@@ -347,7 +349,7 @@ class NTPSnippetsServiceTest : public test::NTPSnippetsTestBase {
void LoadFromJSONString(const std::string& json) {
SetUpFetchResponse(json);
- service()->FetchSnippets();
+ service()->FetchSnippets(true);
base::RunLoop().RunUntilIdle();
}
@@ -871,7 +873,7 @@ TEST_F(NTPSnippetsServiceTest, HistorySyncStateChanges) {
service()->OnDisabledReasonChanged(DisabledReason::SIGNED_OUT);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(NTPSnippetsService::State::DISABLED, service()->state_);
- EXPECT_THAT(service()->snippets(), IsEmpty()); // No fetch should be made.
+ EXPECT_THAT(service()->snippets(), IsEmpty()); // No fetch should be made.
// Simulate user sign in. The service should be ready again and load snippets.
SetUpFetchResponse(GetTestJson({GetSnippet()}));
« no previous file with comments | « components/ntp_snippets/ntp_snippets_service.cc ('k') | components/ntp_snippets/request_throttler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698