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

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

Issue 1654833005: Componentizes shortcuts unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 using ExpectedURLAndAllowedToBeDefault = std::pair<std::string, bool>;
15
16 struct TestShortcutData {
17 TestShortcutData(std::string guid,
18 std::string text,
19 std::string fill_into_edit,
20 std::string destination_url,
21 std::string contents,
22 std::string contents_class,
23 std::string description,
24 std::string description_class,
25 ui::PageTransition transition,
26 AutocompleteMatch::Type type,
27 std::string keyword,
28 int days_from_now,
29 int number_of_hits);
30 ~TestShortcutData();
31
32 std::string guid;
33 std::string text;
34 std::string fill_into_edit;
35 std::string destination_url;
36 std::string contents;
37 std::string contents_class;
38 std::string description;
39 std::string description_class;
40 ui::PageTransition transition;
41 AutocompleteMatch::Type type;
42 std::string keyword;
43 int days_from_now;
44 int number_of_hits;
45 };
46
47 // Fills test data into the shortcuts backend.
48 void PopulateShortcutsBackendWithTestData(
49 scoped_refptr<ShortcutsBackend> backend,
50 TestShortcutData* db,
51 size_t db_size);
52
53 // Runs an autocomplete query on |text| with the provided
54 // |prevent_inline_autocomplete| setting and checks to see that the returned
55 // results' destination URLs match those provided. |expected_urls| does not
56 // need to be in sorted order, but |expected_top_result| should be the top
57 // match, and it should have inline autocompletion
58 // |top_result_inline_autocompletion|.
59 void RunShortcutsProviderTest(
60 scoped_refptr<ShortcutsProvider> provider,
61 const base::string16 text,
62 bool prevent_inline_autocomplete,
63 const std::vector<ExpectedURLAndAllowedToBeDefault>& expected_urls,
64 std::string expected_top_result,
65 base::string16 top_result_inline_autocompletion);
OLDNEW
« no previous file with comments | « components/omnibox/browser/shortcuts_provider.h ('k') | components/omnibox/browser/shortcuts_provider_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698