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/base/testing_browser_process.h" | 5 #include "chrome/test/base/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) | 272 #if defined(OS_WIN) || defined(OS_LINUX) |
273 // This is not really Windows-specific, the transition is just being done | 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. | 274 // in stages, and Windows is first. See below for more info. |
275 DCHECK(!g_browser_process); | 275 DCHECK(!g_browser_process); |
276 #else | 276 #else |
277 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 277 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
278 // ChromeTestSuite sets up a global TestingBrowserProcess | 278 // ChromeTestSuite sets up a global TestingBrowserProcess |
279 // 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 |
280 // a NotificationService, and there can be only one NotificationService | 280 // a NotificationService, and there can be only one NotificationService |
281 // per thread. | 281 // per thread. |
282 DCHECK(g_browser_process); | 282 DCHECK(g_browser_process); |
283 delete g_browser_process; | 283 delete g_browser_process; |
284 #endif | 284 #endif |
285 browser_process_.reset(new TestingBrowserProcess); | 285 browser_process_.reset(new TestingBrowserProcess); |
286 g_browser_process = browser_process_.get(); | 286 g_browser_process = browser_process_.get(); |
287 } | 287 } |
288 | 288 |
289 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() { | 289 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() { |
290 DCHECK_EQ(browser_process_.get(), g_browser_process); | 290 DCHECK_EQ(browser_process_.get(), g_browser_process); |
291 | 291 |
292 #if defined(OS_WIN) | 292 #if defined(OS_WIN) || defined(OS_LINUX) |
293 // This is not really Windows-specific, the transition is just being done | 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. | 294 // in stages, and Windows is first. See below for more info. |
295 g_browser_process = NULL; | 295 g_browser_process = NULL; |
296 #else | 296 #else |
297 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 297 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
298 // After the transition is over, we should just | 298 // After the transition is over, we should just |
299 // reset |g_browser_process| to NULL. | 299 // reset |g_browser_process| to NULL. |
300 browser_process_.reset(); | 300 browser_process_.reset(); |
301 g_browser_process = new TestingBrowserProcess(); | 301 g_browser_process = new TestingBrowserProcess(); |
302 #endif | 302 #endif |
303 } | 303 } |
OLD | NEW |