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

Side by Side Diff: components/omnibox/browser/history_test_util.cc

Issue 2300323003: Adding performance tests for HQP that represent importance of optimising HistoryItemsForTerms method (Closed)
Patch Set: Review, round 4. 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
(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
OLDNEW
« no previous file with comments | « components/omnibox/browser/history_test_util.h ('k') | components/omnibox/browser/in_memory_url_index.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698