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 // An implementation of BrowserProcess for unit tests that fails for most | 5 // An implementation of BrowserProcess for unit tests that fails for most |
6 // services. By preventing creation of services, we reduce dependencies and | 6 // services. By preventing creation of services, we reduce dependencies and |
7 // keep the profile clean. Clients of this class must handle the NULL return | 7 // keep the profile clean. Clients of this class must handle the NULL return |
8 // value, however. | 8 // value, however. |
9 | 9 |
10 #ifndef CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ | 10 #ifndef CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ |
11 #define CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ | 11 #define CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
19 | 19 |
20 class BackgroundModeManager; | 20 class BackgroundModeManager; |
21 class CRLSetFetcher; | 21 class CRLSetFetcher; |
22 class IOThread; | 22 class IOThread; |
23 class MHTMLGenerationManager; | 23 class MHTMLGenerationManager; |
24 class NotificationUIManager; | 24 class NotificationUIManager; |
25 class PrefService; | 25 class PrefServiceSimple; |
26 class WatchDogThread; | 26 class WatchDogThread; |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 class NotificationService; | 29 class NotificationService; |
30 } | 30 } |
31 | 31 |
32 namespace policy { | 32 namespace policy { |
33 class BrowserPolicyConnector; | 33 class BrowserPolicyConnector; |
34 class PolicyService; | 34 class PolicyService; |
35 } | 35 } |
36 | 36 |
37 namespace prerender { | 37 namespace prerender { |
38 class PrerenderTracker; | 38 class PrerenderTracker; |
39 } | 39 } |
40 | 40 |
41 class TestingBrowserProcess : public BrowserProcess { | 41 class TestingBrowserProcess : public BrowserProcess { |
42 public: | 42 public: |
43 TestingBrowserProcess(); | 43 TestingBrowserProcess(); |
44 virtual ~TestingBrowserProcess(); | 44 virtual ~TestingBrowserProcess(); |
45 | 45 |
46 virtual void ResourceDispatcherHostCreated() OVERRIDE; | 46 virtual void ResourceDispatcherHostCreated() OVERRIDE; |
47 virtual void EndSession() OVERRIDE; | 47 virtual void EndSession() OVERRIDE; |
48 virtual MetricsService* metrics_service() OVERRIDE; | 48 virtual MetricsService* metrics_service() OVERRIDE; |
49 virtual IOThread* io_thread() OVERRIDE; | 49 virtual IOThread* io_thread() OVERRIDE; |
50 virtual WatchDogThread* watchdog_thread() OVERRIDE; | 50 virtual WatchDogThread* watchdog_thread() OVERRIDE; |
51 virtual ProfileManager* profile_manager() OVERRIDE; | 51 virtual ProfileManager* profile_manager() OVERRIDE; |
52 virtual PrefService* local_state() OVERRIDE; | 52 virtual PrefServiceSimple* local_state() OVERRIDE; |
53 virtual chrome_variations::VariationsService* variations_service() OVERRIDE; | 53 virtual chrome_variations::VariationsService* variations_service() OVERRIDE; |
54 virtual policy::BrowserPolicyConnector* browser_policy_connector() OVERRIDE; | 54 virtual policy::BrowserPolicyConnector* browser_policy_connector() OVERRIDE; |
55 virtual policy::PolicyService* policy_service() OVERRIDE; | 55 virtual policy::PolicyService* policy_service() OVERRIDE; |
56 virtual IconManager* icon_manager() OVERRIDE; | 56 virtual IconManager* icon_manager() OVERRIDE; |
57 virtual GLStringManager* gl_string_manager() OVERRIDE; | 57 virtual GLStringManager* gl_string_manager() OVERRIDE; |
58 virtual RenderWidgetSnapshotTaker* GetRenderWidgetSnapshotTaker() OVERRIDE; | 58 virtual RenderWidgetSnapshotTaker* GetRenderWidgetSnapshotTaker() OVERRIDE; |
59 virtual BackgroundModeManager* background_mode_manager() OVERRIDE; | 59 virtual BackgroundModeManager* background_mode_manager() OVERRIDE; |
60 virtual StatusTray* status_tray() OVERRIDE; | 60 virtual StatusTray* status_tray() OVERRIDE; |
61 virtual SafeBrowsingService* safe_browsing_service() OVERRIDE; | 61 virtual SafeBrowsingService* safe_browsing_service() OVERRIDE; |
62 virtual safe_browsing::ClientSideDetectionService* | 62 virtual safe_browsing::ClientSideDetectionService* |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 virtual ComponentUpdateService* component_updater() OVERRIDE; | 99 virtual ComponentUpdateService* component_updater() OVERRIDE; |
100 virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; | 100 virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; |
101 virtual BookmarkPromptController* bookmark_prompt_controller() OVERRIDE; | 101 virtual BookmarkPromptController* bookmark_prompt_controller() OVERRIDE; |
102 virtual chrome::MediaFileSystemRegistry* | 102 virtual chrome::MediaFileSystemRegistry* |
103 media_file_system_registry() OVERRIDE; | 103 media_file_system_registry() OVERRIDE; |
104 virtual void PlatformSpecificCommandLineProcessing( | 104 virtual void PlatformSpecificCommandLineProcessing( |
105 const CommandLine& command_line) OVERRIDE; | 105 const CommandLine& command_line) OVERRIDE; |
106 | 106 |
107 // Set the local state for tests. Consumer is responsible for cleaning it up | 107 // Set the local state for tests. Consumer is responsible for cleaning it up |
108 // afterwards (using ScopedTestingLocalState, for example). | 108 // afterwards (using ScopedTestingLocalState, for example). |
109 void SetLocalState(PrefService* local_state); | 109 void SetLocalState(PrefServiceSimple* local_state); |
110 void SetProfileManager(ProfileManager* profile_manager); | 110 void SetProfileManager(ProfileManager* profile_manager); |
111 void SetIOThread(IOThread* io_thread); | 111 void SetIOThread(IOThread* io_thread); |
112 void SetBrowserPolicyConnector(policy::BrowserPolicyConnector* connector); | 112 void SetBrowserPolicyConnector(policy::BrowserPolicyConnector* connector); |
113 void SetSafeBrowsingService(SafeBrowsingService* sb_service); | 113 void SetSafeBrowsingService(SafeBrowsingService* sb_service); |
114 void SetBookmarkPromptController(BookmarkPromptController* controller); | 114 void SetBookmarkPromptController(BookmarkPromptController* controller); |
115 void SetSystemRequestContext(net::URLRequestContextGetter* context_getter); | 115 void SetSystemRequestContext(net::URLRequestContextGetter* context_getter); |
116 | 116 |
117 private: | 117 private: |
118 scoped_ptr<content::NotificationService> notification_service_; | 118 scoped_ptr<content::NotificationService> notification_service_; |
119 unsigned int module_ref_count_; | 119 unsigned int module_ref_count_; |
(...skipping 12 matching lines...) Expand all Loading... |
132 scoped_refptr<printing::PrintPreviewDialogController> | 132 scoped_refptr<printing::PrintPreviewDialogController> |
133 print_preview_dialog_controller_; | 133 print_preview_dialog_controller_; |
134 scoped_ptr<prerender::PrerenderTracker> prerender_tracker_; | 134 scoped_ptr<prerender::PrerenderTracker> prerender_tracker_; |
135 scoped_ptr<RenderWidgetSnapshotTaker> render_widget_snapshot_taker_; | 135 scoped_ptr<RenderWidgetSnapshotTaker> render_widget_snapshot_taker_; |
136 scoped_refptr<SafeBrowsingService> sb_service_; | 136 scoped_refptr<SafeBrowsingService> sb_service_; |
137 scoped_ptr<BookmarkPromptController> bookmark_prompt_controller_; | 137 scoped_ptr<BookmarkPromptController> bookmark_prompt_controller_; |
138 scoped_ptr<chrome::MediaFileSystemRegistry> media_file_system_registry_; | 138 scoped_ptr<chrome::MediaFileSystemRegistry> media_file_system_registry_; |
139 #endif // !defined(OS_IOS) | 139 #endif // !defined(OS_IOS) |
140 | 140 |
141 // The following objects are not owned by TestingBrowserProcess: | 141 // The following objects are not owned by TestingBrowserProcess: |
142 PrefService* local_state_; | 142 PrefServiceSimple* local_state_; |
143 IOThread* io_thread_; | 143 IOThread* io_thread_; |
144 net::URLRequestContextGetter* system_request_context_; | 144 net::URLRequestContextGetter* system_request_context_; |
145 | 145 |
146 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); | 146 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); |
147 }; | 147 }; |
148 | 148 |
149 #endif // CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ | 149 #endif // CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ |
OLD | NEW |