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/files/scoped_temp_dir.h" |
8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
10 #include "base/scoped_temp_dir.h" | |
11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "chrome/browser/google/google_url_tracker.h" | 13 #include "chrome/browser/google/google_url_tracker.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/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "chrome/test/base/testing_pref_service.h" | 20 #include "chrome/test/base/testing_pref_service.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // needs this. | 63 // needs this. |
64 void StartIOThread() { | 64 void StartIOThread() { |
65 io_thread_.StartIOThread(); | 65 io_thread_.StartIOThread(); |
66 } | 66 } |
67 | 67 |
68 static scoped_refptr<RefcountedProfileKeyedService> | 68 static scoped_refptr<RefcountedProfileKeyedService> |
69 GetWebDataServiceForTemplateURLServiceTestingProfile(Profile* profile); | 69 GetWebDataServiceForTemplateURLServiceTestingProfile(Profile* profile); |
70 | 70 |
71 private: | 71 private: |
72 scoped_refptr<WebDataService> service_; | 72 scoped_refptr<WebDataService> service_; |
73 ScopedTempDir temp_dir_; | 73 base::ScopedTempDir temp_dir_; |
74 content::TestBrowserThread db_thread_; | 74 content::TestBrowserThread db_thread_; |
75 content::TestBrowserThread io_thread_; | 75 content::TestBrowserThread io_thread_; |
76 }; | 76 }; |
77 | 77 |
78 | 78 |
79 // Trivial subclass of TemplateURLService that records the last invocation of | 79 // Trivial subclass of TemplateURLService that records the last invocation of |
80 // SetKeywordSearchTermsForURL. | 80 // SetKeywordSearchTermsForURL. |
81 class TestingTemplateURLService : public TemplateURLService { | 81 class TestingTemplateURLService : public TemplateURLService { |
82 public: | 82 public: |
83 static ProfileKeyedService* Build(Profile* profile) { | 83 static ProfileKeyedService* Build(Profile* profile) { |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 return profile_.get(); | 307 return profile_.get(); |
308 } | 308 } |
309 | 309 |
310 void TemplateURLServiceTestUtil::StartIOThread() { | 310 void TemplateURLServiceTestUtil::StartIOThread() { |
311 profile_->StartIOThread(); | 311 profile_->StartIOThread(); |
312 } | 312 } |
313 | 313 |
314 void TemplateURLServiceTestUtil::PumpLoop() { | 314 void TemplateURLServiceTestUtil::PumpLoop() { |
315 message_loop_.RunAllPending(); | 315 message_loop_.RunAllPending(); |
316 } | 316 } |
OLD | NEW |