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" |
11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
12 #include "chrome/browser/prerender/prerender_tracker.h" | 12 #include "chrome/browser/prerender/prerender_tracker.h" |
13 #include "chrome/browser/printing/background_printing_manager.h" | 13 #include "chrome/browser/printing/background_printing_manager.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "content/browser/debugger/devtools_manager.h" |
15 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
16 #include "ui/base/clipboard/clipboard.h" | 17 #include "ui/base/clipboard/clipboard.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 TestingBrowserProcess::TestingBrowserProcess() | 20 TestingBrowserProcess::TestingBrowserProcess() |
20 : module_ref_count_(0), | 21 : module_ref_count_(0), |
21 app_locale_("en"), | 22 app_locale_("en"), |
22 local_state_(NULL), | 23 local_state_(NULL), |
23 io_thread_(NULL) { | 24 io_thread_(NULL), |
| 25 devtools_manager_(NULL) { |
24 } | 26 } |
25 | 27 |
26 TestingBrowserProcess::~TestingBrowserProcess() { | 28 TestingBrowserProcess::~TestingBrowserProcess() { |
27 EXPECT_FALSE(local_state_); | 29 EXPECT_FALSE(local_state_); |
28 } | 30 } |
29 | 31 |
30 void TestingBrowserProcess::EndSession() { | 32 void TestingBrowserProcess::EndSession() { |
31 } | 33 } |
32 | 34 |
33 ResourceDispatcherHost* TestingBrowserProcess::resource_dispatcher_host() { | 35 ResourceDispatcherHost* TestingBrowserProcess::resource_dispatcher_host() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 91 |
90 IconManager* TestingBrowserProcess::icon_manager() { | 92 IconManager* TestingBrowserProcess::icon_manager() { |
91 return NULL; | 93 return NULL; |
92 } | 94 } |
93 | 95 |
94 ThumbnailGenerator* TestingBrowserProcess::GetThumbnailGenerator() { | 96 ThumbnailGenerator* TestingBrowserProcess::GetThumbnailGenerator() { |
95 return NULL; | 97 return NULL; |
96 } | 98 } |
97 | 99 |
98 DevToolsManager* TestingBrowserProcess::devtools_manager() { | 100 DevToolsManager* TestingBrowserProcess::devtools_manager() { |
99 return NULL; | 101 return devtools_manager_.get(); |
100 } | 102 } |
101 | 103 |
102 SidebarManager* TestingBrowserProcess::sidebar_manager() { | 104 SidebarManager* TestingBrowserProcess::sidebar_manager() { |
103 return NULL; | 105 return NULL; |
104 } | 106 } |
105 | 107 |
106 TabCloseableStateWatcher* TestingBrowserProcess::tab_closeable_state_watcher() { | 108 TabCloseableStateWatcher* TestingBrowserProcess::tab_closeable_state_watcher() { |
107 return NULL; | 109 return NULL; |
108 } | 110 } |
109 | 111 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 257 |
256 void TestingBrowserProcess::SetGoogleURLTracker( | 258 void TestingBrowserProcess::SetGoogleURLTracker( |
257 GoogleURLTracker* google_url_tracker) { | 259 GoogleURLTracker* google_url_tracker) { |
258 google_url_tracker_.reset(google_url_tracker); | 260 google_url_tracker_.reset(google_url_tracker); |
259 } | 261 } |
260 | 262 |
261 void TestingBrowserProcess::SetIOThread(IOThread* io_thread) { | 263 void TestingBrowserProcess::SetIOThread(IOThread* io_thread) { |
262 io_thread_ = io_thread; | 264 io_thread_ = io_thread; |
263 } | 265 } |
264 | 266 |
| 267 void TestingBrowserProcess::SetDevToolsManager(DevToolsManager* manager) { |
| 268 devtools_manager_.reset(manager); |
| 269 } |
| 270 |
265 ScopedTestingBrowserProcess::ScopedTestingBrowserProcess() { | 271 ScopedTestingBrowserProcess::ScopedTestingBrowserProcess() { |
266 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 272 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
267 // ChromeTestSuite sets up a global TestingBrowserProcess | 273 // ChromeTestSuite sets up a global TestingBrowserProcess |
268 // for all tests. We need to get rid of it, because it contains | 274 // for all tests. We need to get rid of it, because it contains |
269 // a NotificationService, and there can be only one NotificationService | 275 // a NotificationService, and there can be only one NotificationService |
270 // per thread. | 276 // per thread. |
271 DCHECK(g_browser_process); | 277 DCHECK(g_browser_process); |
272 delete g_browser_process; | 278 delete g_browser_process; |
273 | 279 |
274 browser_process_.reset(new TestingBrowserProcess); | 280 browser_process_.reset(new TestingBrowserProcess); |
275 g_browser_process = browser_process_.get(); | 281 g_browser_process = browser_process_.get(); |
276 } | 282 } |
277 | 283 |
278 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() { | 284 ScopedTestingBrowserProcess::~ScopedTestingBrowserProcess() { |
279 DCHECK_EQ(browser_process_.get(), g_browser_process); | 285 DCHECK_EQ(browser_process_.get(), g_browser_process); |
280 | 286 |
281 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. | 287 // TODO(phajdan.jr): Temporary, for http://crbug.com/61062. |
282 // After the transition is over, we should just | 288 // After the transition is over, we should just |
283 // reset |g_browser_process| to NULL. | 289 // reset |g_browser_process| to NULL. |
284 browser_process_.reset(); | 290 browser_process_.reset(); |
285 g_browser_process = new TestingBrowserProcess(); | 291 g_browser_process = new TestingBrowserProcess(); |
286 } | 292 } |
OLD | NEW |