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 <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); | |
OLD | NEW |