OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/omnibox/browser/history_test_util.h" |
| 6 |
| 7 #include "base/time/time.h" |
| 8 #include "components/history/core/browser/history_database.h" |
| 9 |
| 10 namespace history { |
| 11 |
| 12 void AddFakeURLToHistoryDB(HistoryDatabase* history_db, const URLRow& url_row) { |
| 13 base::Time visit_time = url_row.last_visit(); |
| 14 URLID url_id = history_db->AddURL(url_row); |
| 15 |
| 16 auto AddVisit = [&](ui::PageTransition transition) mutable { |
| 17 // Assume earlier visits are at one-day intervals. |
| 18 visit_time -= base::TimeDelta::FromDays(1); |
| 19 VisitRow row(url_id, visit_time, 0, transition, 1); |
| 20 history_db->AddVisit(&row, SOURCE_BROWSED); |
| 21 }; |
| 22 |
| 23 // Mark the most recent |test_info.typed_count| visits as typed. |
| 24 for (int j = 0; j < url_row.typed_count(); ++j) |
| 25 AddVisit(ui::PAGE_TRANSITION_TYPED); |
| 26 |
| 27 for (int j = url_row.typed_count(); j < url_row.visit_count(); ++j) |
| 28 AddVisit(ui::PAGE_TRANSITION_LINK); |
| 29 } |
| 30 |
| 31 } // namespace history |
OLD | NEW |