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