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

Side by Side Diff: components/omnibox/browser/shortcuts_provider_test_util.h

Issue 1655933004: Refactor to share code between shortcuts tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shortcuts
Patch Set: Created 4 years, 10 months 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 <string>
6 #include <vector>
7
8 #include "base/memory/ref_counted.h"
9 #include "components/omnibox/browser/autocomplete_match.h"
10
11 class ShortcutsBackend;
12 class ShortcutsProvider;
13
14 typedef std::pair<std::string, bool> ShortcutExpectedURLAndAllowedToBeDefault;
Peter Kasting 2016/02/03 00:31:47 Why add the word "Shortcut" on the front of these
rohitrao (ping after 24h) 2016/02/03 14:58:08 There are currently no symbol conflicts, but I am
15 typedef std::vector<ShortcutExpectedURLAndAllowedToBeDefault>
16 ShortcutExpectedURLs;
17
18 struct TestShortcutInfo {
19 TestShortcutInfo(std::string guid,
20 std::string text,
21 std::string fill_into_edit,
22 std::string destination_url,
23 std::string contents,
24 std::string contents_class,
25 std::string description,
26 std::string description_class,
27 ui::PageTransition transition,
28 AutocompleteMatch::Type type,
29 std::string keyword,
30 int days_from_now,
31 int number_of_hits);
32 ~TestShortcutInfo();
33
34 std::string guid;
35 std::string text;
36 std::string fill_into_edit;
37 std::string destination_url;
38 std::string contents;
39 std::string contents_class;
40 std::string description;
41 std::string description_class;
42 ui::PageTransition transition;
43 AutocompleteMatch::Type type;
44 std::string keyword;
45 int days_from_now;
46 int number_of_hits;
47 };
48
49 // Fills test data into the shortcuts backend.
50 void PopulateShortcutsBackendWithTestShortcutData(
51 scoped_refptr<ShortcutsBackend> backend,
52 TestShortcutInfo* db,
53 size_t db_size);
54
55 // Runs an autocomplete query on |text| with the provided
56 // |prevent_inline_autocomplete| setting and checks to see that the returned
57 // results' destination URLs match those provided. |expected_urls| does not
58 // need to be in sorted order, but |expected_top_result| should be the top
59 // match, and it should have inline autocompletion
60 // |top_result_inline_autocompletion|.
61 void RunShortcutsProviderTest(scoped_refptr<ShortcutsProvider> provider,
62 const base::string16 text,
63 bool prevent_inline_autocomplete,
64 const ShortcutExpectedURLs& expected_urls,
65 std::string expected_top_result,
66 base::string16 top_result_inline_autocompletion);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698