| 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 <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 LoadFromJSONString(service.get(), json_str); | 448 LoadFromJSONString(service.get(), json_str); |
| 449 ASSERT_THAT(observer().SuggestionsForCategory(articles_category()), | 449 ASSERT_THAT(observer().SuggestionsForCategory(articles_category()), |
| 450 SizeIs(1)); | 450 SizeIs(1)); |
| 451 ASSERT_THAT(service->GetSnippetsForTesting(), SizeIs(1)); | 451 ASSERT_THAT(service->GetSnippetsForTesting(), SizeIs(1)); |
| 452 const ContentSuggestion& suggestion = | 452 const ContentSuggestion& suggestion = |
| 453 observer().SuggestionsForCategory(articles_category()).front(); | 453 observer().SuggestionsForCategory(articles_category()).front(); |
| 454 | 454 |
| 455 EXPECT_EQ(MakeUniqueID(*service, kSnippetUrl), suggestion.id()); | 455 EXPECT_EQ(MakeUniqueID(*service, kSnippetUrl), suggestion.id()); |
| 456 EXPECT_EQ(kSnippetTitle, base::UTF16ToUTF8(suggestion.title())); | 456 EXPECT_EQ(kSnippetTitle, base::UTF16ToUTF8(suggestion.title())); |
| 457 EXPECT_EQ(kSnippetText, base::UTF16ToUTF8(suggestion.snippet_text())); | 457 EXPECT_EQ(kSnippetText, base::UTF16ToUTF8(suggestion.snippet_text())); |
| 458 // EXPECT_EQ(GURL(kSnippetSalientImage), suggestion.salient_image_url()); | |
| 459 EXPECT_EQ(GetDefaultCreationTime(), suggestion.publish_date()); | 458 EXPECT_EQ(GetDefaultCreationTime(), suggestion.publish_date()); |
| 460 EXPECT_EQ(kSnippetPublisherName, | 459 EXPECT_EQ(kSnippetPublisherName, |
| 461 base::UTF16ToUTF8(suggestion.publisher_name())); | 460 base::UTF16ToUTF8(suggestion.publisher_name())); |
| 462 EXPECT_EQ(GURL(kSnippetAmpUrl), suggestion.amp_url()); | 461 EXPECT_EQ(GURL(kSnippetAmpUrl), suggestion.amp_url()); |
| 463 } | 462 } |
| 464 | 463 |
| 465 TEST_F(NTPSnippetsServiceTest, Clear) { | 464 TEST_F(NTPSnippetsServiceTest, Clear) { |
| 466 EXPECT_CALL(mock_scheduler(), Schedule(_, _, _, _)); | 465 EXPECT_CALL(mock_scheduler(), Schedule(_, _, _, _)); |
| 467 auto service = MakeSnippetsService(); | 466 auto service = MakeSnippetsService(); |
| 468 | 467 |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 service->FetchSuggestionImage( | 858 service->FetchSuggestionImage( |
| 860 MakeUniqueID(*service, kSnippetUrl2), | 859 MakeUniqueID(*service, kSnippetUrl2), |
| 861 base::Bind(&MockFunction<void(const gfx::Image&)>::Call, | 860 base::Bind(&MockFunction<void(const gfx::Image&)>::Call, |
| 862 base::Unretained(&image_fetched))); | 861 base::Unretained(&image_fetched))); |
| 863 | 862 |
| 864 base::RunLoop().RunUntilIdle(); | 863 base::RunLoop().RunUntilIdle(); |
| 865 EXPECT_TRUE(image.IsEmpty()); | 864 EXPECT_TRUE(image.IsEmpty()); |
| 866 } | 865 } |
| 867 | 866 |
| 868 } // namespace ntp_snippets | 867 } // namespace ntp_snippets |
| OLD | NEW |