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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "components/bookmarks/browser/bookmark_model.h" | 12 #include "components/bookmarks/browser/bookmark_model.h" |
13 #include "components/bookmarks/browser/bookmark_node.h" | 13 #include "components/bookmarks/browser/bookmark_node.h" |
14 #include "components/bookmarks/test/test_bookmark_client.h" | 14 #include "components/bookmarks/test/test_bookmark_client.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 using bookmarks::BookmarkModel; | 19 using bookmarks::BookmarkModel; |
20 using bookmarks::BookmarkNode; | 20 using bookmarks::BookmarkNode; |
21 | 21 |
22 using testing::IsEmpty; | 22 using testing::IsEmpty; |
23 using testing::SizeIs; | 23 using testing::SizeIs; |
24 using testing::UnorderedElementsAre; | |
25 | 24 |
26 namespace ntp_snippets { | 25 namespace ntp_snippets { |
27 | 26 |
28 namespace { | 27 namespace { |
29 | 28 |
30 const char kBookmarkLastVisitDateKey[] = "last_visited"; | 29 const char kBookmarkLastVisitDateKey[] = "last_visited"; |
31 | 30 |
32 std::unique_ptr<BookmarkModel> CreateModelWithRecentBookmarks( | 31 std::unique_ptr<BookmarkModel> CreateModelWithRecentBookmarks( |
33 int number_of_bookmarks, | 32 int number_of_bookmarks, |
34 int number_of_recent, | 33 int number_of_recent, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 113 |
115 const int max_count = number_of_recent - 1; | 114 const int max_count = number_of_recent - 1; |
116 std::vector<const bookmarks::BookmarkNode*> result = | 115 std::vector<const bookmarks::BookmarkNode*> result = |
117 GetRecentlyVisitedBookmarks(model.get(), max_count, max_count, | 116 GetRecentlyVisitedBookmarks(model.get(), max_count, max_count, |
118 threshold_time(), | 117 threshold_time(), |
119 /*creation_date_fallback=*/false); | 118 /*creation_date_fallback=*/false); |
120 EXPECT_THAT(result, SizeIs(max_count)); | 119 EXPECT_THAT(result, SizeIs(max_count)); |
121 } | 120 } |
122 | 121 |
123 } // namespace ntp_snippets | 122 } // namespace ntp_snippets |
OLD | NEW |