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

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

Issue 2744253004: NTP: clang-format (Closed)
Patch Set: rebase 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 <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 EXPECT_THAT(fetcher().last_status(), Eq("OK")); 496 EXPECT_THAT(fetcher().last_status(), Eq("OK"));
497 EXPECT_THAT(fetcher().last_json(), Eq(kJsonStr)); 497 EXPECT_THAT(fetcher().last_json(), Eq(kJsonStr));
498 EXPECT_THAT(histogram_tester().GetAllSamples( 498 EXPECT_THAT(histogram_tester().GetAllSamples(
499 "NewTabPage.Snippets.FetchHttpResponseOrErrorCode"), 499 "NewTabPage.Snippets.FetchHttpResponseOrErrorCode"),
500 ElementsAre(base::Bucket(/*min=*/200, /*count=*/1))); 500 ElementsAre(base::Bucket(/*min=*/200, /*count=*/1)));
501 EXPECT_THAT(histogram_tester().GetAllSamples("NewTabPage.Snippets.FetchTime"), 501 EXPECT_THAT(histogram_tester().GetAllSamples("NewTabPage.Snippets.FetchTime"),
502 ElementsAre(base::Bucket(/*min=*/kTestJsonParsingLatencyMs, 502 ElementsAre(base::Bucket(/*min=*/kTestJsonParsingLatencyMs,
503 /*count=*/1))); 503 /*count=*/1)));
504 } 504 }
505 505
506 TEST_F(RemoteSuggestionsSignedInFetcherTest, 506 TEST_F(RemoteSuggestionsSignedInFetcherTest, ShouldRetryWhenOAuthCancelled) {
507 ShouldRetryWhenOAuthCancelled) {
508 SignIn(); 507 SignIn();
509 IssueRefreshToken(); 508 IssueRefreshToken();
510 509
511 const std::string kJsonStr = 510 const std::string kJsonStr =
512 "{\"categories\" : [{" 511 "{\"categories\" : [{"
513 " \"id\": 1," 512 " \"id\": 1,"
514 " \"localizedTitle\": \"Articles for You\"," 513 " \"localizedTitle\": \"Articles for You\","
515 " \"suggestions\" : [{" 514 " \"suggestions\" : [{"
516 " \"ids\" : [\"http://localhost/foobar\"]," 515 " \"ids\" : [\"http://localhost/foobar\"],"
517 " \"title\" : \"Foo Barred from Baz\"," 516 " \"title\" : \"Foo Barred from Baz\","
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 fetched_categories) { 989 fetched_categories) {
991 if (fetched_categories) { 990 if (fetched_categories) {
992 // Matchers above aren't any more precise than this, so this is sufficient 991 // Matchers above aren't any more precise than this, so this is sufficient
993 // for test-failure diagnostics. 992 // for test-failure diagnostics.
994 return os << "list with " << fetched_categories->size() << " elements"; 993 return os << "list with " << fetched_categories->size() << " elements";
995 } 994 }
996 return os << "null"; 995 return os << "null";
997 } 996 }
998 997
999 } // namespace ntp_snippets 998 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698