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

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

Issue 2095553002: Make callers of FromUTC(Local)Exploded in components/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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 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/ntp_snippets_service.h" 5 #include "components/ntp_snippets/ntp_snippets_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 const char kSnippetUrl[] = "http://localhost/foobar"; 63 const char kSnippetUrl[] = "http://localhost/foobar";
64 const char kSnippetTitle[] = "Title"; 64 const char kSnippetTitle[] = "Title";
65 const char kSnippetText[] = "Snippet"; 65 const char kSnippetText[] = "Snippet";
66 const char kSnippetSalientImage[] = "http://localhost/salient_image"; 66 const char kSnippetSalientImage[] = "http://localhost/salient_image";
67 const char kSnippetPublisherName[] = "Foo News"; 67 const char kSnippetPublisherName[] = "Foo News";
68 const char kSnippetAmpUrl[] = "http://localhost/amp"; 68 const char kSnippetAmpUrl[] = "http://localhost/amp";
69 const float kSnippetScore = 5.0; 69 const float kSnippetScore = 5.0;
70 70
71 base::Time GetDefaultCreationTime() { 71 base::Time GetDefaultCreationTime() {
72 return base::Time::FromUTCExploded(kDefaultCreationTime); 72 base::Time out_time;
73 EXPECT_TRUE(base::Time::FromUTCExploded(kDefaultCreationTime, &out_time));
74 return out_time;
73 } 75 }
74 76
75 base::Time GetDefaultExpirationTime() { 77 base::Time GetDefaultExpirationTime() {
76 return base::Time::Now() + base::TimeDelta::FromHours(1); 78 return base::Time::Now() + base::TimeDelta::FromHours(1);
77 } 79 }
78 80
79 std::string GetTestJson(const std::vector<std::string>& snippets) { 81 std::string GetTestJson(const std::vector<std::string>& snippets) {
80 return base::StringPrintf("{\"recos\":[%s]}", 82 return base::StringPrintf("{\"recos\":[%s]}",
81 base::JoinString(snippets, ", ").c_str()); 83 base::JoinString(snippets, ", ").c_str());
82 } 84 }
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 SetUpFetchResponse(GetTestJson({GetSnippet()})); 931 SetUpFetchResponse(GetTestJson({GetSnippet()}));
930 service()->OnStateChanged(); 932 service()->OnStateChanged();
931 base::RunLoop().RunUntilIdle(); 933 base::RunLoop().RunUntilIdle();
932 EXPECT_EQ(NTPSnippetsService::State::READY, service()->state_); 934 EXPECT_EQ(NTPSnippetsService::State::READY, service()->state_);
933 EXPECT_FALSE(service()->snippets().empty()); 935 EXPECT_FALSE(service()->snippets().empty());
934 936
935 service()->RemoveObserver(&mock_observer); 937 service()->RemoveObserver(&mock_observer);
936 } 938 }
937 939
938 } // namespace ntp_snippets 940 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698