OLD | NEW |
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/bookmarks/bookmark_last_visit_utils.h" | 5 #include "components/ntp_snippets/bookmarks/bookmark_last_visit_utils.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 const int max_count = number_of_bookmarks - 1; | 154 const int max_count = number_of_bookmarks - 1; |
155 std::vector<const bookmarks::BookmarkNode*> result = | 155 std::vector<const bookmarks::BookmarkNode*> result = |
156 GetRecentlyVisitedBookmarks(model.get(), max_count, threshold_time(), | 156 GetRecentlyVisitedBookmarks(model.get(), max_count, threshold_time(), |
157 /*consider_visits_from_desktop=*/false); | 157 /*consider_visits_from_desktop=*/false); |
158 EXPECT_THAT(result, SizeIs(max_count)); | 158 EXPECT_THAT(result, SizeIs(max_count)); |
159 } | 159 } |
160 | 160 |
161 namespace { | 161 namespace { |
162 | 162 |
163 base::Callback<bool(const GURL& url)> DeleteAllFilter() { | 163 base::Callback<bool(const GURL& url)> DeleteAllFilter() { |
164 return base::Bind([] (const GURL& url) { return true; }); | 164 return base::Bind([](const GURL& url) { return true; }); |
165 } | 165 } |
166 | 166 |
167 base::Callback<bool(const GURL& url)> DeleteOneURLFilter( | 167 base::Callback<bool(const GURL& url)> DeleteOneURLFilter( |
168 const GURL& to_delete) { | 168 const GURL& to_delete) { |
169 return base::Bind( | 169 return base::Bind( |
170 [](const GURL& to_delete, const GURL& url) { return url == to_delete; }, | 170 [](const GURL& to_delete, const GURL& url) { return url == to_delete; }, |
171 to_delete); | 171 to_delete); |
172 } | 172 } |
173 | 173 |
174 } // namespace | 174 } // namespace |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 model.get()); | 290 model.get()); |
291 | 291 |
292 std::vector<const bookmarks::BookmarkNode*> remaining_nodes = | 292 std::vector<const bookmarks::BookmarkNode*> remaining_nodes = |
293 GetRecentlyVisitedBookmarks(model.get(), 20, base::Time(), | 293 GetRecentlyVisitedBookmarks(model.get(), 20, base::Time(), |
294 /*consider_visits_from_desktop=*/false); | 294 /*consider_visits_from_desktop=*/false); |
295 EXPECT_THAT(remaining_nodes, SizeIs(1)); | 295 EXPECT_THAT(remaining_nodes, SizeIs(1)); |
296 EXPECT_THAT(remaining_nodes[0]->url(), Eq(GURL("http://url-1.com"))); | 296 EXPECT_THAT(remaining_nodes[0]->url(), Eq(GURL("http://url-1.com"))); |
297 } | 297 } |
298 | 298 |
299 } // namespace ntp_snippets | 299 } // namespace ntp_snippets |
OLD | NEW |