OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_INSTANT_UNITTEST_BASE_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_ |
6 #define CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_ | 6 #define CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
11 #include "chrome/browser/search/instant_service.h" | 11 #include "chrome/browser/search/instant_service.h" |
12 #include "chrome/browser/search_engines/template_url_service.h" | 12 #include "chrome/browser/search_engines/template_url_service.h" |
13 #include "chrome/test/base/browser_with_test_window_test.h" | 13 #include "chrome/test/base/browser_with_test_window_test.h" |
14 | 14 |
15 class InstantServiceObserver; | 15 class InstantServiceObserver; |
16 | 16 |
17 // This class provides an extension on top of BrowserWithTestWindowTest, and | 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 | 18 // adds some utility methods which can be useful for various unit tests for |
19 // Embedded Search / Instant implementation classes. | 19 // Embedded Search / Instant implementation classes. |
20 class InstantUnitTestBase : public BrowserWithTestWindowTest { | 20 class InstantUnitTestBase : public BrowserWithTestWindowTest { |
21 protected: | 21 protected: |
22 InstantUnitTestBase(); | 22 InstantUnitTestBase(); |
23 virtual ~InstantUnitTestBase(); | 23 virtual ~InstantUnitTestBase(); |
24 | 24 |
25 virtual void SetUp() OVERRIDE; | 25 virtual void SetUp() OVERRIDE; |
26 virtual void TearDown() OVERRIDE; | 26 virtual void TearDown() OVERRIDE; |
27 | 27 |
28 virtual void SetUpWithoutCacheableNTP(); | 28 void SetUpWithoutCacheableNTP(); |
Jered
2014/02/07 03:02:26
We should delete this. Is that easy to do in this
kmadhusu
2014/02/11 01:40:02
Will fix it in a separate CL.
| |
29 virtual void SetUpHelper(); | 29 void SetUpWithoutQueryExtraction(); |
30 | 30 |
31 // Adds and sets the default search provider using the base_url. | 31 // Adds and sets the default search provider using the base_url. |
32 // The base_url should have the http[s]:// prefix and a trailing / after the | 32 // The base_url should have the http[s]:// prefix and a trailing / after the |
33 // TLD. | 33 // TLD. |
34 // It will always use an instant-enabled configuration using a | 34 // It will always use an instant-enabled configuration using a |
35 // search_terms_replacement_key. | 35 // search_terms_replacement_key. |
36 void SetDefaultSearchProvider(const std::string& base_url); | 36 void SetDefaultSearchProvider(const std::string& base_url); |
37 | 37 |
38 // Simulates a Google Base URL change as would happen in event of | 38 // Simulates a Google Base URL change as would happen in event of |
39 // search-domain-check. Note that the GoogleURLTrackerFactory is disabled for | 39 // search-domain-check. Note that the GoogleURLTrackerFactory is disabled for |
40 // tests, so this is required. | 40 // tests, so this is required. |
41 void NotifyGoogleBaseURLUpdate(const std::string& new_google_base_url); | 41 void NotifyGoogleBaseURLUpdate(const std::string& new_google_base_url); |
42 | 42 |
43 bool IsInstantServiceObserver(InstantServiceObserver* observer); | 43 bool IsInstantServiceObserver(InstantServiceObserver* observer); |
44 | 44 |
45 InstantService* instant_service_; | 45 InstantService* instant_service_; |
46 TemplateURLService* template_url_service_; | 46 TemplateURLService* template_url_service_; |
47 scoped_ptr<base::FieldTrialList> field_trial_list_; | 47 scoped_ptr<base::FieldTrialList> field_trial_list_; |
48 | |
49 private: | |
50 void SetUpHelper(); | |
51 | |
52 bool enable_query_extraction_; | |
48 }; | 53 }; |
49 | 54 |
50 #endif // CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_ | 55 #endif // CHROME_BROWSER_SEARCH_INSTANT_UNITTEST_BASE_H_ |
OLD | NEW |