OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_engines/template_url_service_test_util.h" | 5 #include "chrome/browser/search_engines/template_url_service_test_util.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/google/google_url_tracker.h" | 12 #include "chrome/browser/google/google_url_tracker.h" |
13 #include "chrome/browser/search_engines/default_search_manager.h" | 13 #include "chrome/browser/search_engines/default_search_manager.h" |
14 #include "chrome/browser/search_engines/search_terms_data.h" | 14 #include "chrome/browser/search_engines/search_terms_data.h" |
15 #include "chrome/browser/search_engines/template_url_service.h" | 15 #include "chrome/browser/search_engines/template_url_service.h" |
16 #include "chrome/browser/search_engines/template_url_service_factory.h" | 16 #include "chrome/browser/search_engines/template_url_service_factory.h" |
17 #include "chrome/browser/webdata/web_data_service_factory.h" | 17 #include "chrome/browser/webdata/web_data_service_factory.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "chrome/test/base/testing_pref_service_syncable.h" | 19 #include "chrome/test/base/testing_pref_service_syncable.h" |
20 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
22 | 22 |
23 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
24 #include "chrome/browser/google/google_util_chromeos.h" | 24 #include "chrome/browser/google/google_brand_chromeos.h" |
25 #endif | 25 #endif |
26 | 26 |
27 // Trivial subclass of TemplateURLService that records the last invocation of | 27 // Trivial subclass of TemplateURLService that records the last invocation of |
28 // SetKeywordSearchTermsForURL. | 28 // SetKeywordSearchTermsForURL. |
29 class TestingTemplateURLService : public TemplateURLService { | 29 class TestingTemplateURLService : public TemplateURLService { |
30 public: | 30 public: |
31 static KeyedService* Build(content::BrowserContext* profile) { | 31 static KeyedService* Build(content::BrowserContext* profile) { |
32 return new TestingTemplateURLService(static_cast<Profile*>(profile)); | 32 return new TestingTemplateURLService(static_cast<Profile*>(profile)); |
33 } | 33 } |
34 | 34 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 | 210 |
211 void TemplateURLServiceTestUtil::SetUp() { | 211 void TemplateURLServiceTestUtil::SetUp() { |
212 // Make unique temp directory. | 212 // Make unique temp directory. |
213 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 213 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
214 profile_.reset(new TestingProfile(temp_dir_.path())); | 214 profile_.reset(new TestingProfile(temp_dir_.path())); |
215 | 215 |
216 TemplateURLServiceTestUtilBase::CreateTemplateUrlService(); | 216 TemplateURLServiceTestUtilBase::CreateTemplateUrlService(); |
217 | 217 |
218 #if defined(OS_CHROMEOS) | 218 #if defined(OS_CHROMEOS) |
219 google_util::chromeos::ClearBrandForCurrentSession(); | 219 google_brand::chromeos::ClearBrandForCurrentSession(); |
220 #endif | 220 #endif |
221 } | 221 } |
222 | 222 |
223 void TemplateURLServiceTestUtil::TearDown() { | 223 void TemplateURLServiceTestUtil::TearDown() { |
224 profile_.reset(); | 224 profile_.reset(); |
225 | 225 |
226 UIThreadSearchTermsData::SetGoogleBaseURL(std::string()); | 226 UIThreadSearchTermsData::SetGoogleBaseURL(std::string()); |
227 | 227 |
228 // Flush the message loop to make application verifiers happy. | 228 // Flush the message loop to make application verifiers happy. |
229 base::RunLoop().RunUntilIdle(); | 229 base::RunLoop().RunUntilIdle(); |
230 } | 230 } |
231 | 231 |
232 TestingProfile* TemplateURLServiceTestUtil::profile() const { | 232 TestingProfile* TemplateURLServiceTestUtil::profile() const { |
233 return profile_.get(); | 233 return profile_.get(); |
234 } | 234 } |
OLD | NEW |