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 "chrome/browser/google/google_url_tracker.h" | 8 #include "chrome/browser/google/google_url_tracker.h" |
9 #include "chrome/browser/notifications/notification_ui_manager.h" | 9 #include "chrome/browser/notifications/notification_ui_manager.h" |
10 #include "chrome/browser/policy/browser_policy_connector.h" | 10 #include "chrome/browser/policy/browser_policy_connector.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 262 |
263 void TestingBrowserProcess::SetIOThread(IOThread* io_thread) { | 263 void TestingBrowserProcess::SetIOThread(IOThread* io_thread) { |
264 io_thread_ = io_thread; | 264 io_thread_ = io_thread; |
265 } | 265 } |
266 | 266 |
267 void TestingBrowserProcess::SetDevToolsManager(DevToolsManager* manager) { | 267 void TestingBrowserProcess::SetDevToolsManager(DevToolsManager* manager) { |
268 devtools_manager_.reset(manager); | 268 devtools_manager_.reset(manager); |
269 } | 269 } |
270 | 270 |
271 ScopedTestingBrowserProcess::ScopedTestingBrowserProcess() { | 271 ScopedTestingBrowserProcess::ScopedTestingBrowserProcess() { |
| 272 #if defined(OS_WIN) |
| 273 // This is not really Windows-specific, the transition is just being done |
| 274 // in stages, and Windows is first. See below for more info. |
| 275 DCHECK(!g_browser_process); |
| 276 #else |
272 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 277 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
273 // ChromeTestSuite sets up a global TestingBrowserProcess | 278 // ChromeTestSuite sets up a global TestingBrowserProcess |
274 // for all tests. We need to get rid of it, because it contains | 279 // for all tests. We need to get rid of it, because it contains |
275 // a NotificationService, and there can be only one NotificationService | 280 // a NotificationService, and there can be only one NotificationService |
276 // per thread. | 281 // per thread. |
277 DCHECK(g_browser_process); | 282 DCHECK(g_browser_process); |
278 delete g_browser_process; | 283 delete g_browser_process; |
279 | 284 #endif |
280 browser_process_.reset(new TestingBrowserProcess); | 285 browser_process_.reset(new TestingBrowserProcess); |
281 g_browser_process = browser_process_.get(); | 286 g_browser_process = browser_process_.get(); |
282 } | 287 } |
283 | 288 |
284 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() { | 289 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() { |
285 DCHECK_EQ(browser_process_.get(), g_browser_process); | 290 DCHECK_EQ(browser_process_.get(), g_browser_process); |
286 | 291 |
| 292 #if defined(OS_WIN) |
| 293 // This is not really Windows-specific, the transition is just being done |
| 294 // in stages, and Windows is first. See below for more info. |
| 295 g_browser_process = NULL; |
| 296 #else |
287 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 297 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
288 // After the transition is over, we should just | 298 // After the transition is over, we should just |
289 // reset |g_browser_process| to NULL. | 299 // reset |g_browser_process| to NULL. |
290 browser_process_.reset(); | 300 browser_process_.reset(); |
291 g_browser_process = new TestingBrowserProcess(); | 301 g_browser_process = new TestingBrowserProcess(); |
| 302 #endif |
292 } | 303 } |
OLD | NEW |