OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test/testing_browser_process.h" | 5 #include "chrome/test/testing_browser_process.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "chrome/browser/google/google_url_tracker.h" | 9 #include "chrome/browser/google/google_url_tracker.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 } | 185 } |
186 | 186 |
187 void TestingBrowserProcess::SetPrefService(PrefService* pref_service) { | 187 void TestingBrowserProcess::SetPrefService(PrefService* pref_service) { |
188 pref_service_ = pref_service; | 188 pref_service_ = pref_service; |
189 } | 189 } |
190 | 190 |
191 void TestingBrowserProcess::SetGoogleURLTracker( | 191 void TestingBrowserProcess::SetGoogleURLTracker( |
192 GoogleURLTracker* google_url_tracker) { | 192 GoogleURLTracker* google_url_tracker) { |
193 google_url_tracker_.reset(google_url_tracker); | 193 google_url_tracker_.reset(google_url_tracker); |
194 } | 194 } |
| 195 |
| 196 ScopedTestingBrowserProcess::ScopedTestingBrowserProcess() { |
| 197 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
| 198 // ChromeTestSuite sets up a global TestingBrowserProcess |
| 199 // for all tests. We need to get rid of it, because it contains |
| 200 // a NotificationService, and there can be only one NotificationService |
| 201 // per thread. |
| 202 DCHECK(g_browser_process); |
| 203 delete g_browser_process; |
| 204 |
| 205 browser_process_.reset(new TestingBrowserProcess); |
| 206 g_browser_process = browser_process_.get(); |
| 207 } |
| 208 |
| 209 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() { |
| 210 DCHECK_EQ(browser_process_.get(), g_browser_process); |
| 211 |
| 212 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
| 213 // After the transition is over, we should just |
| 214 // reset |g_browser_process| to NULL. |
| 215 browser_process_.reset(); |
| 216 g_browser_process = new TestingBrowserProcess(); |
| 217 } |
OLD | NEW |