| Index: components/history/core/browser/history_backend_unittest.cc
|
| diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc
|
| index b8cd5d9647d94c61e8ef8071faf7fc712d528ef5..ad4dd62086e75188b7b92b86b8209aa282fb77ad 100644
|
| --- a/components/history/core/browser/history_backend_unittest.cc
|
| +++ b/components/history/core/browser/history_backend_unittest.cc
|
| @@ -3806,4 +3806,33 @@ TEST_F(InMemoryHistoryBackendTest, OnURLsDeletedWithSearchTerms) {
|
| EXPECT_FALSE(mem_backend_->db()->GetKeywordSearchTermRow(row2.id(), NULL));
|
| }
|
|
|
| +TEST_F(HistoryBackendTest, QueryMostVisitedURLs) {
|
| + ASSERT_TRUE(backend_.get());
|
| +
|
| + std::vector<ui::PageTransition> page_transitions;
|
| + page_transitions.push_back(ui::PAGE_TRANSITION_AUTO_BOOKMARK); // good.
|
| + page_transitions.push_back(ui::PAGE_TRANSITION_LINK); // bad.
|
| + page_transitions.push_back(ui::PageTransitionFromInt(
|
| + ui::PAGE_TRANSITION_AUTO_BOOKMARK |
|
| + ui::PAGE_TRANSITION_IGNORE_FOR_NTP_TILES)); // bad.
|
| + page_transitions.push_back(ui::PAGE_TRANSITION_TYPED); // good.
|
| +
|
| + for (size_t i = 0; i < page_transitions.size(); ++i) {
|
| + HistoryAddPageArgs args;
|
| + args.url = GURL("http://example" + base::SizeTToString(i + 1) + ".com");
|
| + args.time = base::Time::Now() - base::TimeDelta::FromDays(i + 1);
|
| + args.transition = page_transitions[i];
|
| + backend_->AddPage(args);
|
| + }
|
| +
|
| + MostVisitedURLList most_visited;
|
| + backend_->QueryMostVisitedURLs(100, 100, &most_visited);
|
| +
|
| + const base::string16 kSomeTitle; // Ignored by equality operator.
|
| + EXPECT_THAT(
|
| + most_visited,
|
| + ElementsAre(MostVisitedURL(GURL("http://example1.com"), kSomeTitle),
|
| + MostVisitedURL(GURL("http://example4.com"), kSomeTitle)));
|
| +}
|
| +
|
| } // namespace history
|
|
|