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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
857 | 857 |
858 service->FetchSuggestionImage( | 858 service->FetchSuggestionImage( |
859 MakeUniqueID(*service, kSnippetUrl2), | 859 MakeUniqueID(*service, kSnippetUrl2), |
860 base::Bind(&MockFunction<void(const gfx::Image&)>::Call, | 860 base::Bind(&MockFunction<void(const gfx::Image&)>::Call, |
861 base::Unretained(&image_fetched))); | 861 base::Unretained(&image_fetched))); |
862 | 862 |
863 base::RunLoop().RunUntilIdle(); | 863 base::RunLoop().RunUntilIdle(); |
864 EXPECT_TRUE(image.IsEmpty()); | 864 EXPECT_TRUE(image.IsEmpty()); |
865 } | 865 } |
866 | 866 |
867 TEST_F(NTPSnippetsServiceTest, NukeAllSnippetsRemovesAllSuggestions) { | |
868 auto service = MakeSnippetsService(); | |
869 | |
870 std::string first_snippet = GetSnippetWithUrl("http://url1.com"); | |
871 std::string second_snippet = GetSnippetWithUrl("http://url2.com"); | |
872 std::string json_str = GetTestJson({first_snippet, second_snippet}); | |
873 LoadFromJSONString(service.get(), json_str); | |
874 ASSERT_THAT(service->GetSnippetsForTesting(), SizeIs(2)); | |
875 | |
876 service->DismissSuggestion(MakeUniqueID(*service, "http://url1.com")); | |
877 ASSERT_THAT(service->GetSnippetsForTesting(), SizeIs(1)); | |
878 ASSERT_THAT(service->dismissed_snippets_, SizeIs(1)); | |
879 | |
880 service->NukeAllSnippets(); | |
Marc Treib
2016/09/01 14:11:20
Call ClearHistory instead, so you call a public AP
vitaliii
2016/09/01 14:45:15
Done.
| |
881 | |
882 EXPECT_THAT(service->GetSnippetsForTesting(), IsEmpty()); | |
883 EXPECT_THAT(service->dismissed_snippets_, IsEmpty()); | |
884 } | |
885 | |
867 } // namespace ntp_snippets | 886 } // namespace ntp_snippets |
OLD | NEW |