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 #include "chrome/browser/search/instant_unittest_base.h" | 5 #include "chrome/browser/search/instant_unittest_base.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/search/instant_service.h" | 12 #include "chrome/browser/search/instant_service.h" |
13 #include "chrome/browser/search/instant_service_factory.h" | 13 #include "chrome/browser/search/instant_service_factory.h" |
14 #include "chrome/browser/search/search.h" | 14 #include "chrome/browser/search/search.h" |
15 #include "chrome/browser/search_engines/template_url_service_factory.h" | 15 #include "chrome/browser/search_engines/template_url_service_factory.h" |
16 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 16 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
17 #include "chrome/test/base/browser_with_test_window_test.h" | 17 #include "chrome/test/base/browser_with_test_window_test.h" |
18 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
19 #include "components/google/core/browser/google_pref_names.h" | 19 #include "components/google/core/browser/google_pref_names.h" |
20 #include "components/google/core/browser/google_url_tracker.h" | 20 #include "components/google/core/browser/google_url_tracker.h" |
| 21 #include "components/search/search.h" |
21 #include "components/search_engines/template_url.h" | 22 #include "components/search_engines/template_url.h" |
22 #include "components/search_engines/template_url_service.h" | 23 #include "components/search_engines/template_url_service.h" |
23 #include "components/variations/entropy_provider.h" | 24 #include "components/variations/entropy_provider.h" |
24 | 25 |
25 InstantUnitTestBase::InstantUnitTestBase() { | 26 InstantUnitTestBase::InstantUnitTestBase() { |
26 field_trial_list_.reset(new base::FieldTrialList( | 27 field_trial_list_.reset(new base::FieldTrialList( |
27 new metrics::SHA1EntropyProvider("42"))); | 28 new metrics::SHA1EntropyProvider("42"))); |
28 } | 29 } |
29 | 30 |
30 InstantUnitTestBase::~InstantUnitTestBase() { | 31 InstantUnitTestBase::~InstantUnitTestBase() { |
31 } | 32 } |
32 | 33 |
33 void InstantUnitTestBase::SetUp() { | 34 void InstantUnitTestBase::SetUp() { |
34 chrome::EnableQueryExtractionForTesting(); | 35 search::EnableQueryExtractionForTesting(); |
35 SetUpHelper(); | 36 SetUpHelper(); |
36 } | 37 } |
37 | 38 |
38 void InstantUnitTestBase::TearDown() { | 39 void InstantUnitTestBase::TearDown() { |
39 UIThreadSearchTermsData::SetGoogleBaseURL(""); | 40 UIThreadSearchTermsData::SetGoogleBaseURL(""); |
40 BrowserWithTestWindowTest::TearDown(); | 41 BrowserWithTestWindowTest::TearDown(); |
41 } | 42 } |
42 | 43 |
43 #if !defined(OS_IOS) && !defined(OS_ANDROID) | 44 #if !defined(OS_IOS) && !defined(OS_ANDROID) |
44 void InstantUnitTestBase::SetUpWithoutQueryExtraction() { | 45 void InstantUnitTestBase::SetUpWithoutQueryExtraction() { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 void InstantUnitTestBase::SetUpHelper() { | 92 void InstantUnitTestBase::SetUpHelper() { |
92 BrowserWithTestWindowTest::SetUp(); | 93 BrowserWithTestWindowTest::SetUp(); |
93 | 94 |
94 template_url_service_ = TemplateURLServiceFactory::GetForProfile(profile()); | 95 template_url_service_ = TemplateURLServiceFactory::GetForProfile(profile()); |
95 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service_); | 96 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service_); |
96 | 97 |
97 UIThreadSearchTermsData::SetGoogleBaseURL("https://www.google.com/"); | 98 UIThreadSearchTermsData::SetGoogleBaseURL("https://www.google.com/"); |
98 SetUserSelectedDefaultSearchProvider("{google:baseURL}"); | 99 SetUserSelectedDefaultSearchProvider("{google:baseURL}"); |
99 instant_service_ = InstantServiceFactory::GetForProfile(profile()); | 100 instant_service_ = InstantServiceFactory::GetForProfile(profile()); |
100 } | 101 } |
OLD | NEW |