Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / search_engines / template_url_service_factory_test_util.h
blobd8fb48134497e5c51f57aec49f800c7ae4597527
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
3 // found in the LICENSE file.
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_
8 #include <string>
10 #include "base/basictypes.h"
12 class TemplateURLService;
13 class TestingProfile;
15 // TemplateURLServiceFactoryTestUtil initializes TemplateURLServiceFactory to
16 // return a valid TemplateURLService instance for the given profile.
17 class TemplateURLServiceFactoryTestUtil {
18 public:
19 explicit TemplateURLServiceFactoryTestUtil(TestingProfile* profile);
20 virtual ~TemplateURLServiceFactoryTestUtil();
22 // Makes sure the load was successful.
23 void VerifyLoad();
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);
39 // Remove all the managed preferences for the default search provider and
40 // trigger notification.
41 void RemoveManagedDefaultSearchPreferences();
43 // Returns the TemplateURLService.
44 TemplateURLService* model() const;
46 private:
47 TestingProfile* profile_;
49 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceFactoryTestUtil);
52 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_FACTORY_TEST_UTIL_H_