- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / search / instant_unittest_base.h
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.
4
5 #ifndef CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_
6 #define CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_
7
8 #include <string>
9
10 #include "chrome/browser/search/instant_service.h"
11 #include "chrome/browser/search_engines/template_url_service.h"
12 #include "chrome/test/base/browser_with_test_window_test.h"
13
14 class InstantServiceObserver;
15
16 // 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.
19 class InstantUnitTestBase : public BrowserWithTestWindowTest {
20  protected:
21   virtual void SetUp() OVERRIDE;
22   virtual void TearDown() OVERRIDE;
23
24   // Adds and sets the default search provider using the base_url.
25   // The base_url should have the http[s]:// prefix and a trailing / after the
26   // TLD.
27   // It will always use an instant-enabled configuration using a
28   // search_terms_replacement_key.
29   void SetDefaultSearchProvider(const std::string& base_url);
30
31   // Simulates a Google Base URL change as would happen in event of
32   // search-domain-check. Note that the GoogleURLTrackerFactory is disabled for
33   // tests, so this is required.
34   void NotifyGoogleBaseURLUpdate(const std::string& new_google_base_url);
35
36   bool IsInstantServiceObserver(InstantServiceObserver* observer);
37
38   InstantService* instant_service_;
39   TemplateURLService* template_url_service_;
40 };
41
42 #endif  // CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_