Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / search / instant_unittest_base.h
blob267895abe08c2428ee184eb513715ec4b7211a27
1 // Copyright 2013 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_INSTANT_UNITTEST_BASE_H_
6 #define CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_
8 #include <string>
10 #include "base/metrics/field_trial.h"
11 #include "chrome/browser/search/instant_service.h"
12 #include "chrome/test/base/browser_with_test_window_test.h"
13 #include "components/search_engines/template_url_service.h"
15 class InstantServiceObserver;
17 // This class provides an extension on top of BrowserWithTestWindowTest, and
18 // adds some utility methods which can be useful for various unit tests for
19 // Embedded Search / Instant implementation classes.
20 class InstantUnitTestBase : public BrowserWithTestWindowTest {
21 protected:
22 InstantUnitTestBase();
23 ~InstantUnitTestBase() override;
25 void SetUp() override;
26 void TearDown() override;
28 #if !defined(OS_IOS) && !defined(OS_ANDROID)
29 // Query extraction is always enabled on Android and iOS.
30 void SetUpWithoutQueryExtraction();
31 #endif
33 // Adds and sets the default search provider using the base_url.
34 // The base_url should have the http[s]:// prefix and a trailing / after the
35 // TLD.
36 // It will always use an instant-enabled configuration using a
37 // search_terms_replacement_key.
38 void SetUserSelectedDefaultSearchProvider(const std::string& base_url);
40 // Simulates a Google Base URL change as would happen in event of
41 // search-domain-check. Note that the GoogleURLTrackerFactory is disabled for
42 // tests, so this is required.
43 void NotifyGoogleBaseURLUpdate(const std::string& new_google_base_url);
45 bool IsInstantServiceObserver(const InstantServiceObserver* observer) const;
47 InstantService* instant_service_;
48 TemplateURLService* template_url_service_;
49 scoped_ptr<base::FieldTrialList> field_trial_list_;
51 private:
52 // BrowserWithTestWindowTest override:
53 TestingProfile* CreateProfile() override;
55 void SetUpHelper();
58 #endif // CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_