blob: 2956d2d7acdc42f0d13adf5e0a2ad61606f368dc [file] [log] [blame]
[email protected]c8a118e2013-09-24 21:33:401// 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.
4
5#ifndef CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_
6#define CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_
7
8#include <string>
9
[email protected]1ddfd9a2013-11-15 00:12:2010#include "base/metrics/field_trial.h"
avib896c712015-12-26 02:10:4311#include "build/build_config.h"
[email protected]c8a118e2013-09-24 21:33:4012#include "chrome/browser/search/instant_service.h"
[email protected]c8a118e2013-09-24 21:33:4013#include "chrome/test/base/browser_with_test_window_test.h"
[email protected]bf5c532d2014-07-05 00:29:5314#include "components/search_engines/template_url_service.h"
[email protected]c8a118e2013-09-24 21:33:4015
[email protected]c8a118e2013-09-24 21:33:4016// This class provides an extension on top of BrowserWithTestWindowTest, and
17// adds some utility methods which can be useful for various unit tests for
18// Embedded Search / Instant implementation classes.
19class InstantUnitTestBase : public BrowserWithTestWindowTest {
20 protected:
[email protected]1ddfd9a2013-11-15 00:12:2021 InstantUnitTestBase();
dchenge1bc7982014-10-30 00:32:4022 ~InstantUnitTestBase() override;
[email protected]1ddfd9a2013-11-15 00:12:2023
dchenge1bc7982014-10-30 00:32:4024 void SetUp() override;
25 void TearDown() override;
[email protected]c8a118e2013-09-24 21:33:4026
27 // Adds and sets the default search provider using the base_url.
28 // The base_url should have the http[s]:// prefix and a trailing / after the
29 // TLD.
30 // It will always use an instant-enabled configuration using a
31 // search_terms_replacement_key.
[email protected]f1cb5582014-04-25 07:35:2632 void SetUserSelectedDefaultSearchProvider(const std::string& base_url);
[email protected]c8a118e2013-09-24 21:33:4033
34 // Simulates a Google Base URL change as would happen in event of
35 // search-domain-check. Note that the GoogleURLTrackerFactory is disabled for
36 // tests, so this is required.
37 void NotifyGoogleBaseURLUpdate(const std::string& new_google_base_url);
38
[email protected]c8a118e2013-09-24 21:33:4039 InstantService* instant_service_;
40 TemplateURLService* template_url_service_;
dcheng4af48582016-04-19 00:29:3541 std::unique_ptr<base::FieldTrialList> field_trial_list_;
[email protected]50da1902014-02-14 02:40:1942
43 private:
[email protected]c4b2af22014-05-11 19:48:5344 // BrowserWithTestWindowTest override:
Daniel Chenga542fca2014-10-21 09:51:2945 TestingProfile* CreateProfile() override;
[email protected]c8a118e2013-09-24 21:33:4046};
47
48#endif // CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_