OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_SEARCH_ENGINES_SEARCH_ENGINES_TEST_UTIL_H_ | 5 #ifndef COMPONENTS_SEARCH_ENGINES_SEARCH_ENGINES_TEST_UTIL_H_ |
6 #define COMPONENTS_SEARCH_ENGINES_SEARCH_ENGINES_TEST_UTIL_H_ | 6 #define COMPONENTS_SEARCH_ENGINES_SEARCH_ENGINES_TEST_UTIL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 struct TemplateURLData; | 11 struct TemplateURLData; |
12 | 12 |
13 namespace sync_preferences { | 13 namespace sync_preferences { |
14 class TestingPrefServiceSyncable; | 14 class TestingPrefServiceSyncable; |
15 } | 15 } |
16 | 16 |
17 // Generates a TemplateURLData structure useful for tests filled with values | 17 // Generates a TemplateURLData structure useful for tests filled with values |
18 // autogenerated from |provider_name|. | 18 // autogenerated from |provider_name|. |
19 std::unique_ptr<TemplateURLData> GenerateDummyTemplateURLData( | 19 std::unique_ptr<TemplateURLData> GenerateDummyTemplateURLData( |
20 const std::string& provider_name); | 20 const std::string& keyword); |
21 | 21 |
22 // Checks that the two TemplateURLs are similar. Does not check the id, the | 22 // Checks that the two TemplateURLs are similar. Does not check the id, the |
23 // date_created or the last_modified time. Neither pointer should be null. | 23 // date_created or the last_modified time. Neither pointer should be null. |
24 void ExpectSimilar(const TemplateURLData* expected, | 24 void ExpectSimilar(const TemplateURLData* expected, |
25 const TemplateURLData* actual); | 25 const TemplateURLData* actual); |
26 | 26 |
27 // Writes default search engine |extension_data| into the extension-controlled | 27 // Writes default search engine |extension_data| into the extension-controlled |
28 // preference in |prefs|. | 28 // preference in |prefs|. |
29 void SetExtensionDefaultSearchInPrefs( | 29 void SetExtensionDefaultSearchInPrefs( |
30 sync_preferences::TestingPrefServiceSyncable* prefs, | 30 sync_preferences::TestingPrefServiceSyncable* prefs, |
31 const TemplateURLData& extension_data); | 31 const TemplateURLData& extension_data); |
32 | 32 |
33 // Removes the extension-controlled default search engine preference from | 33 // Removes the extension-controlled default search engine preference from |
34 // |prefs|. | 34 // |prefs|. |
35 void RemoveExtensionDefaultSearchFromPrefs( | 35 void RemoveExtensionDefaultSearchFromPrefs( |
36 sync_preferences::TestingPrefServiceSyncable* prefs); | 36 sync_preferences::TestingPrefServiceSyncable* prefs); |
37 | 37 |
38 #endif // COMPONENTS_SEARCH_ENGINES_SEARCH_ENGINES_TEST_UTIL_H_ | 38 #endif // COMPONENTS_SEARCH_ENGINES_SEARCH_ENGINES_TEST_UTIL_H_ |
OLD | NEW |