OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_TEST_UTIL_H_ |
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_TEST_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 | 11 |
12 class TemplateURLService; | 12 class TemplateURLService; |
13 class TestingProfile; | 13 class TestingProfile; |
14 | 14 |
15 // TemplateURLServiceFactoryTestUtil initializes TemplateURLServiceFactory to | 15 // TemplateURLServiceFactoryTestUtil initializes TemplateURLServiceFactory to |
16 // return a valid TemplateURLService instance for the given profile. | 16 // return a valid TemplateURLService instance for the given profile. |
17 class TemplateURLServiceFactoryTestUtil { | 17 class TemplateURLServiceFactoryTestUtil { |
18 public: | 18 public: |
19 explicit TemplateURLServiceFactoryTestUtil(TestingProfile* profile); | 19 explicit TemplateURLServiceFactoryTestUtil(TestingProfile* profile); |
20 virtual ~TemplateURLServiceFactoryTestUtil(); | 20 virtual ~TemplateURLServiceFactoryTestUtil(); |
21 | 21 |
22 // Makes sure the load was successful. | 22 // Makes sure the load was successful. |
23 void VerifyLoad(); | 23 void VerifyLoad(); |
24 | 24 |
25 // Set the managed preferences for the default search provider and trigger | |
26 // notification. If |alternate_url| is empty, uses an empty list of alternate | |
27 // URLs, otherwise use a list containing a single entry. | |
28 void SetManagedDefaultSearchPreferences( | |
29 bool enabled, | |
30 const std::string& name, | |
31 const std::string& keyword, | |
32 const std::string& search_url, | |
33 const std::string& suggest_url, | |
34 const std::string& icon_url, | |
35 const std::string& encodings, | |
36 const std::string& alternate_url, | |
37 const std::string& search_terms_replacement_key); | |
38 | |
39 // Remove all the managed preferences for the default search provider and | |
40 // trigger notification. | |
41 void RemoveManagedDefaultSearchPreferences(); | |
42 | |
43 // Returns the TemplateURLService. | 25 // Returns the TemplateURLService. |
44 TemplateURLService* model() const; | 26 TemplateURLService* model() const; |
45 | 27 |
46 private: | 28 private: |
47 TestingProfile* profile_; | 29 TestingProfile* profile_; |
48 | 30 |
49 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceFactoryTestUtil); | 31 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceFactoryTestUtil); |
50 }; | 32 }; |
51 | 33 |
52 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_TEST_UTIL_
H_ | 34 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_TEST_UTIL_
H_ |
OLD | NEW |