OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/background/background_mode_manager.h" | 10 #include "chrome/browser/background/background_mode_manager.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/browser_process_impl.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" | 14 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" |
14 #include "chrome/test/base/testing_browser_process_platform_part.h" | 15 #include "chrome/test/base/testing_browser_process_platform_part.h" |
15 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
16 #include "net/url_request/url_request_context_getter.h" | 17 #include "net/url_request/url_request_context_getter.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "ui/message_center/message_center.h" | 19 #include "ui/message_center/message_center.h" |
19 | 20 |
20 #if !defined(OS_IOS) | 21 #if !defined(OS_IOS) |
21 #include "chrome/browser/media_galleries/media_file_system_registry.h" | |
22 #include "chrome/browser/notifications/notification_ui_manager.h" | 22 #include "chrome/browser/notifications/notification_ui_manager.h" |
23 #include "chrome/browser/prerender/prerender_tracker.h" | 23 #include "chrome/browser/prerender/prerender_tracker.h" |
24 #include "chrome/browser/printing/background_printing_manager.h" | 24 #include "chrome/browser/printing/background_printing_manager.h" |
25 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 25 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
26 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 26 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
27 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h" | 27 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h" |
28 #endif | 28 #endif |
29 | 29 |
| 30 #if !defined(OS_IOS) && !defined(OS_ANDROID) |
| 31 #include "chrome/browser/media_galleries/media_file_system_registry.h" |
| 32 #include "chrome/browser/storage_monitor/storage_monitor.h" |
| 33 #include "chrome/browser/storage_monitor/test_storage_monitor.h" |
| 34 #endif |
| 35 |
30 #if defined(ENABLE_CONFIGURATION_POLICY) | 36 #if defined(ENABLE_CONFIGURATION_POLICY) |
31 #include "chrome/browser/policy/browser_policy_connector.h" | 37 #include "chrome/browser/policy/browser_policy_connector.h" |
32 #else | 38 #else |
33 #include "chrome/browser/policy/policy_service_stub.h" | 39 #include "chrome/browser/policy/policy_service_stub.h" |
34 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 40 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
35 | 41 |
36 // static | 42 // static |
37 TestingBrowserProcess* TestingBrowserProcess::GetGlobal() { | 43 TestingBrowserProcess* TestingBrowserProcess::GetGlobal() { |
38 return static_cast<TestingBrowserProcess*>(g_browser_process); | 44 return static_cast<TestingBrowserProcess*>(g_browser_process); |
39 } | 45 } |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 313 |
308 BookmarkPromptController* TestingBrowserProcess::bookmark_prompt_controller() { | 314 BookmarkPromptController* TestingBrowserProcess::bookmark_prompt_controller() { |
309 #if defined(OS_IOS) | 315 #if defined(OS_IOS) |
310 NOTIMPLEMENTED(); | 316 NOTIMPLEMENTED(); |
311 return NULL; | 317 return NULL; |
312 #else | 318 #else |
313 return bookmark_prompt_controller_.get(); | 319 return bookmark_prompt_controller_.get(); |
314 #endif | 320 #endif |
315 } | 321 } |
316 | 322 |
| 323 chrome::StorageMonitor* TestingBrowserProcess::storage_monitor() { |
| 324 #if defined(OS_IOS) || defined(OS_ANDROID) |
| 325 NOTIMPLEMENTED(); |
| 326 return NULL; |
| 327 #else |
| 328 if (!storage_monitor_.get()) { |
| 329 chrome::test::TestStorageMonitor* monitor = |
| 330 new chrome::test::TestStorageMonitor(); |
| 331 monitor->Init(); |
| 332 monitor->MarkInitialized(); |
| 333 storage_monitor_.reset(monitor); |
| 334 } |
| 335 return storage_monitor_.get(); |
| 336 #endif |
| 337 } |
| 338 |
317 chrome::MediaFileSystemRegistry* | 339 chrome::MediaFileSystemRegistry* |
318 TestingBrowserProcess::media_file_system_registry() { | 340 TestingBrowserProcess::media_file_system_registry() { |
319 #if defined(OS_IOS) || defined (OS_ANDROID) | 341 #if defined(OS_IOS) || defined(OS_ANDROID) |
320 NOTIMPLEMENTED(); | 342 NOTIMPLEMENTED(); |
321 return NULL; | 343 return NULL; |
322 #else | 344 #else |
323 if (!media_file_system_registry_) | 345 if (!media_file_system_registry_) |
324 media_file_system_registry_.reset(new chrome::MediaFileSystemRegistry()); | 346 media_file_system_registry_.reset(new chrome::MediaFileSystemRegistry()); |
325 return media_file_system_registry_.get(); | 347 return media_file_system_registry_.get(); |
326 #endif | 348 #endif |
327 } | 349 } |
328 | 350 |
329 bool TestingBrowserProcess::created_local_state() const { | 351 bool TestingBrowserProcess::created_local_state() const { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 #endif | 407 #endif |
386 } | 408 } |
387 | 409 |
388 void TestingBrowserProcess::SetSafeBrowsingService( | 410 void TestingBrowserProcess::SetSafeBrowsingService( |
389 SafeBrowsingService* sb_service) { | 411 SafeBrowsingService* sb_service) { |
390 #if !defined(OS_IOS) | 412 #if !defined(OS_IOS) |
391 NOTIMPLEMENTED(); | 413 NOTIMPLEMENTED(); |
392 sb_service_ = sb_service; | 414 sb_service_ = sb_service; |
393 #endif | 415 #endif |
394 } | 416 } |
| 417 |
| 418 void TestingBrowserProcess::SetStorageMonitor( |
| 419 chrome::StorageMonitor* storage_monitor) { |
| 420 #if !defined(OS_IOS) && !defined(OS_ANDROID) |
| 421 storage_monitor_.reset(storage_monitor); |
| 422 #endif |
| 423 } |
| 424 |
| 425 // static |
| 426 void TestingBrowserProcess::SetStorageMonitorForBrowserTests( |
| 427 chrome::StorageMonitor* storage_monitor) { |
| 428 BrowserProcessImpl* browser_process = |
| 429 static_cast<BrowserProcessImpl*>(g_browser_process); |
| 430 browser_process->SetStorageMonitorForTesting(storage_monitor); |
| 431 } |
OLD | NEW |