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

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

Issue 2485933003: Fixes an invalidated pointer access in NTPSnipppetsFetcher. (Closed)
Patch Set: adressed other comments from https://codereview.chromium.org/2473483006/ Created 4 years, 1 month 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/content_suggestions_service.h" 5 #include "components/ntp_snippets/content_suggestions_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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 observer()->OnSuggestionInvalidated(this, suggestion_id); 85 observer()->OnSuggestionInvalidated(this, suggestion_id);
86 } 86 }
87 87
88 MOCK_METHOD3(ClearHistory, 88 MOCK_METHOD3(ClearHistory,
89 void(base::Time begin, 89 void(base::Time begin,
90 base::Time end, 90 base::Time end,
91 const base::Callback<bool(const GURL& url)>& filter)); 91 const base::Callback<bool(const GURL& url)>& filter));
92 MOCK_METHOD3(Fetch, 92 MOCK_METHOD3(Fetch,
93 void(const Category&, 93 void(const Category&,
94 const std::set<std::string>&, 94 const std::set<std::string>&,
95 FetchingCallback)); 95 const FetchingCallback&));
96 MOCK_METHOD1(ClearCachedSuggestions, void(Category category)); 96 MOCK_METHOD1(ClearCachedSuggestions, void(Category category));
97 MOCK_METHOD2(GetDismissedSuggestionsForDebugging, 97 MOCK_METHOD2(GetDismissedSuggestionsForDebugging,
98 void(Category category, 98 void(Category category,
99 const DismissedSuggestionsCallback& callback)); 99 const DismissedSuggestionsCallback& callback));
100 MOCK_METHOD1(ClearDismissedSuggestionsForDebugging, void(Category category)); 100 MOCK_METHOD1(ClearDismissedSuggestionsForDebugging, void(Category category));
101 MOCK_METHOD1(DismissSuggestion, 101 MOCK_METHOD1(DismissSuggestion,
102 void(const ContentSuggestion::ID& suggestion_id)); 102 void(const ContentSuggestion::ID& suggestion_id));
103 MOCK_METHOD2(FetchSuggestionImage, 103 MOCK_METHOD2(FetchSuggestionImage,
104 void(const ContentSuggestion::ID& suggestion_id, 104 void(const ContentSuggestion::ID& suggestion_id,
105 const ImageFetchedCallback& callback)); 105 const ImageFetchedCallback& callback));
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 provider = RegisterProvider(category); 700 provider = RegisterProvider(category);
701 provider->FireCategoryStatusChangedWithCurrentStatus(category); 701 provider->FireCategoryStatusChangedWithCurrentStatus(category);
702 EXPECT_TRUE(service()->IsCategoryDismissed(category)); 702 EXPECT_TRUE(service()->IsCategoryDismissed(category));
703 703
704 service()->RestoreDismissedCategories(); 704 service()->RestoreDismissedCategories();
705 EXPECT_FALSE(service()->IsCategoryDismissed(category)); 705 EXPECT_FALSE(service()->IsCategoryDismissed(category));
706 EXPECT_THAT(providers().find(category)->second, Eq(provider)); 706 EXPECT_THAT(providers().find(category)->second, Eq(provider));
707 } 707 }
708 708
709 } // namespace ntp_snippets 709 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698