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