Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: chrome/test/base/testing_browser_process.cc

Issue 16703025: [StorageMonitor] Move StorageMonitor ownership to BrowserProcessImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" 12 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h"
13 #include "chrome/test/base/testing_browser_process_platform_part.h" 13 #include "chrome/test/base/testing_browser_process_platform_part.h"
14 #include "content/public/browser/notification_service.h" 14 #include "content/public/browser/notification_service.h"
15 #include "net/url_request/url_request_context_getter.h" 15 #include "net/url_request/url_request_context_getter.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/message_center/message_center.h" 17 #include "ui/message_center/message_center.h"
18 18
19 #if !defined(OS_IOS) 19 #if !defined(OS_IOS)
20 #include "chrome/browser/media_galleries/media_file_system_registry.h"
21 #include "chrome/browser/notifications/notification_ui_manager.h" 20 #include "chrome/browser/notifications/notification_ui_manager.h"
22 #include "chrome/browser/prerender/prerender_tracker.h" 21 #include "chrome/browser/prerender/prerender_tracker.h"
23 #include "chrome/browser/printing/background_printing_manager.h" 22 #include "chrome/browser/printing/background_printing_manager.h"
24 #include "chrome/browser/printing/print_preview_dialog_controller.h" 23 #include "chrome/browser/printing/print_preview_dialog_controller.h"
25 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 24 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
26 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h" 25 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h"
27 #endif 26 #endif
28 27
28 #if !defined(OS_IOS) && !defined(OS_ANDROID)
29 #include "chrome/browser/media_galleries/media_file_system_registry.h"
30 #include "chrome/browser/storage_monitor/storage_monitor.h"
31 #include "chrome/browser/storage_monitor/test_storage_monitor.h"
32 #endif
33
29 #if defined(ENABLE_CONFIGURATION_POLICY) 34 #if defined(ENABLE_CONFIGURATION_POLICY)
30 #include "chrome/browser/policy/browser_policy_connector.h" 35 #include "chrome/browser/policy/browser_policy_connector.h"
31 #else 36 #else
32 #include "chrome/browser/policy/policy_service_stub.h" 37 #include "chrome/browser/policy/policy_service_stub.h"
33 #endif // defined(ENABLE_CONFIGURATION_POLICY) 38 #endif // defined(ENABLE_CONFIGURATION_POLICY)
34 39
35 // static 40 // static
36 TestingBrowserProcess* TestingBrowserProcess::GetGlobal() { 41 TestingBrowserProcess* TestingBrowserProcess::GetGlobal() {
37 return static_cast<TestingBrowserProcess*>(g_browser_process); 42 return static_cast<TestingBrowserProcess*>(g_browser_process);
38 } 43 }
39 44
40 TestingBrowserProcess::TestingBrowserProcess() 45 TestingBrowserProcess::TestingBrowserProcess()
41 : notification_service_(content::NotificationService::Create()), 46 : notification_service_(content::NotificationService::Create()),
42 module_ref_count_(0), 47 module_ref_count_(0),
43 app_locale_("en"), 48 app_locale_("en"),
44 #if !defined(OS_IOS) 49 #if !defined(OS_IOS)
45 render_widget_snapshot_taker_(new RenderWidgetSnapshotTaker), 50 render_widget_snapshot_taker_(new RenderWidgetSnapshotTaker),
46 #endif 51 #endif
52 #if !defined(OS_IOS) && !defined(OS_ANDROID)
53 storage_monitor_(new chrome::test::TestStorageMonitor),
Lei Zhang 2013/06/27 00:09:38 What's preventing this from only being created whe
Greg Billock 2013/06/27 18:25:43 Nothing. I can do that.
54 #endif
47 local_state_(NULL), 55 local_state_(NULL),
48 io_thread_(NULL), 56 io_thread_(NULL),
49 system_request_context_(NULL), 57 system_request_context_(NULL),
50 platform_part_(new TestingBrowserProcessPlatformPart()) { 58 platform_part_(new TestingBrowserProcessPlatformPart()) {
51 } 59 }
52 60
53 TestingBrowserProcess::~TestingBrowserProcess() { 61 TestingBrowserProcess::~TestingBrowserProcess() {
54 EXPECT_FALSE(local_state_); 62 EXPECT_FALSE(local_state_);
55 #if defined(ENABLE_CONFIGURATION_POLICY) 63 #if defined(ENABLE_CONFIGURATION_POLICY)
56 SetBrowserPolicyConnector(NULL); 64 SetBrowserPolicyConnector(NULL);
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 309
302 BookmarkPromptController* TestingBrowserProcess::bookmark_prompt_controller() { 310 BookmarkPromptController* TestingBrowserProcess::bookmark_prompt_controller() {
303 #if defined(OS_IOS) 311 #if defined(OS_IOS)
304 NOTIMPLEMENTED(); 312 NOTIMPLEMENTED();
305 return NULL; 313 return NULL;
306 #else 314 #else
307 return bookmark_prompt_controller_.get(); 315 return bookmark_prompt_controller_.get();
308 #endif 316 #endif
309 } 317 }
310 318
319 chrome::StorageMonitor* TestingBrowserProcess::storage_monitor() {
320 #if defined(OS_IOS) || defined(OS_ANDROID)
321 NOTIMPLEMENTED();
322 return NULL;
323 #else
324 return storage_monitor_.get();
325 #endif
326 }
327
311 chrome::MediaFileSystemRegistry* 328 chrome::MediaFileSystemRegistry*
312 TestingBrowserProcess::media_file_system_registry() { 329 TestingBrowserProcess::media_file_system_registry() {
313 #if defined(OS_IOS) || defined (OS_ANDROID) 330 #if defined(OS_IOS) || defined(OS_ANDROID)
314 NOTIMPLEMENTED(); 331 NOTIMPLEMENTED();
315 return NULL; 332 return NULL;
316 #else 333 #else
317 if (!media_file_system_registry_) 334 if (!media_file_system_registry_)
318 media_file_system_registry_.reset(new chrome::MediaFileSystemRegistry()); 335 media_file_system_registry_.reset(new chrome::MediaFileSystemRegistry());
319 return media_file_system_registry_.get(); 336 return media_file_system_registry_.get();
320 #endif 337 #endif
321 } 338 }
322 339
323 bool TestingBrowserProcess::created_local_state() const { 340 bool TestingBrowserProcess::created_local_state() const {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 #endif 396 #endif
380 } 397 }
381 398
382 void TestingBrowserProcess::SetSafeBrowsingService( 399 void TestingBrowserProcess::SetSafeBrowsingService(
383 SafeBrowsingService* sb_service) { 400 SafeBrowsingService* sb_service) {
384 #if !defined(OS_IOS) 401 #if !defined(OS_IOS)
385 NOTIMPLEMENTED(); 402 NOTIMPLEMENTED();
386 sb_service_ = sb_service; 403 sb_service_ = sb_service;
387 #endif 404 #endif
388 } 405 }
406
407 void TestingBrowserProcess::SetStorageMonitor(
408 chrome::StorageMonitor* storage_monitor) {
409 #if !defined(OS_IOS) && !defined(OS_ANDROID)
410 storage_monitor_.reset(storage_monitor);
411 #endif
412 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698