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

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

Issue 2744253004: NTP: clang-format (Closed)
Patch Set: Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/remote_suggestions_fetcher.h" 5 #include "components/ntp_snippets/remote/remote_suggestions_fetcher.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 EXPECT_THAT(fetcher().last_status(), Eq("OK")); 542 EXPECT_THAT(fetcher().last_status(), Eq("OK"));
543 EXPECT_THAT(fetcher().last_json(), Eq(kJsonStr)); 543 EXPECT_THAT(fetcher().last_json(), Eq(kJsonStr));
544 EXPECT_THAT(histogram_tester().GetAllSamples( 544 EXPECT_THAT(histogram_tester().GetAllSamples(
545 "NewTabPage.Snippets.FetchHttpResponseOrErrorCode"), 545 "NewTabPage.Snippets.FetchHttpResponseOrErrorCode"),
546 ElementsAre(base::Bucket(/*min=*/200, /*count=*/1))); 546 ElementsAre(base::Bucket(/*min=*/200, /*count=*/1)));
547 EXPECT_THAT(histogram_tester().GetAllSamples("NewTabPage.Snippets.FetchTime"), 547 EXPECT_THAT(histogram_tester().GetAllSamples("NewTabPage.Snippets.FetchTime"),
548 ElementsAre(base::Bucket(/*min=*/kTestJsonParsingLatencyMs, 548 ElementsAre(base::Bucket(/*min=*/kTestJsonParsingLatencyMs,
549 /*count=*/1))); 549 /*count=*/1)));
550 } 550 }
551 551
552 TEST_F(RemoteSuggestionsSignedInFetcherTest, 552 TEST_F(RemoteSuggestionsSignedInFetcherTest, ShouldRetryWhenOAuthCancelled) {
553 ShouldRetryWhenOAuthCancelled) {
554 SignIn(); 553 SignIn();
555 IssueRefreshToken(); 554 IssueRefreshToken();
556 555
557 const std::string kJsonStr = 556 const std::string kJsonStr =
558 "{\"categories\" : [{" 557 "{\"categories\" : [{"
559 " \"id\": 1," 558 " \"id\": 1,"
560 " \"localizedTitle\": \"Articles for You\"," 559 " \"localizedTitle\": \"Articles for You\","
561 " \"suggestions\" : [{" 560 " \"suggestions\" : [{"
562 " \"ids\" : [\"http://localhost/foobar\"]," 561 " \"ids\" : [\"http://localhost/foobar\"],"
563 " \"title\" : \"Foo Barred from Baz\"," 562 " \"title\" : \"Foo Barred from Baz\","
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 fetched_categories) { 1016 fetched_categories) {
1018 if (fetched_categories) { 1017 if (fetched_categories) {
1019 // Matchers above aren't any more precise than this, so this is sufficient 1018 // Matchers above aren't any more precise than this, so this is sufficient
1020 // for test-failure diagnostics. 1019 // for test-failure diagnostics.
1021 return os << "list with " << fetched_categories->size() << " elements"; 1020 return os << "list with " << fetched_categories->size() << " elements";
1022 } 1021 }
1023 return os << "null"; 1022 return os << "null";
1024 } 1023 }
1025 1024
1026 } // namespace ntp_snippets 1025 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698