| OLD | NEW |
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 const char kSnippetUrl[] = "http://localhost/foobar"; | 61 const char kSnippetUrl[] = "http://localhost/foobar"; |
| 62 const char kSnippetTitle[] = "Title"; | 62 const char kSnippetTitle[] = "Title"; |
| 63 const char kSnippetText[] = "Snippet"; | 63 const char kSnippetText[] = "Snippet"; |
| 64 const char kSnippetSalientImage[] = "http://localhost/salient_image"; | 64 const char kSnippetSalientImage[] = "http://localhost/salient_image"; |
| 65 const char kSnippetPublisherName[] = "Foo News"; | 65 const char kSnippetPublisherName[] = "Foo News"; |
| 66 const char kSnippetAmpUrl[] = "http://localhost/amp"; | 66 const char kSnippetAmpUrl[] = "http://localhost/amp"; |
| 67 const float kSnippetScore = 5.0; | 67 const float kSnippetScore = 5.0; |
| 68 | 68 |
| 69 base::Time GetDefaultCreationTime() { | 69 base::Time GetDefaultCreationTime() { |
| 70 return base::Time::FromUTCExploded(kDefaultCreationTime); | 70 base::Time out_time; |
| 71 EXPECT_TRUE(base::Time::FromUTCExploded(kDefaultCreationTime, &out_time)); |
| 72 return out_time; |
| 71 } | 73 } |
| 72 | 74 |
| 73 base::Time GetDefaultExpirationTime() { | 75 base::Time GetDefaultExpirationTime() { |
| 74 return base::Time::Now() + base::TimeDelta::FromHours(1); | 76 return base::Time::Now() + base::TimeDelta::FromHours(1); |
| 75 } | 77 } |
| 76 | 78 |
| 77 std::string GetTestJson(const std::vector<std::string>& snippets) { | 79 std::string GetTestJson(const std::vector<std::string>& snippets) { |
| 78 return base::StringPrintf("{\"recos\":[%s]}", | 80 return base::StringPrintf("{\"recos\":[%s]}", |
| 79 base::JoinString(snippets, ", ").c_str()); | 81 base::JoinString(snippets, ", ").c_str()); |
| 80 } | 82 } |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 EXPECT_CALL(mock_scheduler(), Schedule(_, _, _, _)).Times(1); | 869 EXPECT_CALL(mock_scheduler(), Schedule(_, _, _, _)).Times(1); |
| 868 service()->UpdateStateForStatus(DisabledReason::NONE); | 870 service()->UpdateStateForStatus(DisabledReason::NONE); |
| 869 base::RunLoop().RunUntilIdle(); | 871 base::RunLoop().RunUntilIdle(); |
| 870 EXPECT_EQ(NTPSnippetsService::State::READY, service()->state_); | 872 EXPECT_EQ(NTPSnippetsService::State::READY, service()->state_); |
| 871 EXPECT_FALSE(service()->snippets().empty()); | 873 EXPECT_FALSE(service()->snippets().empty()); |
| 872 | 874 |
| 873 service()->RemoveObserver(&mock_observer); | 875 service()->RemoveObserver(&mock_observer); |
| 874 } | 876 } |
| 875 | 877 |
| 876 } // namespace ntp_snippets | 878 } // namespace ntp_snippets |
| OLD | NEW |