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_ |
(...skipping 20 matching lines...) Expand all Loading... |
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 namespace ui { | |
42 class Clipboard; | |
43 } | |
44 | |
45 class TestingBrowserProcess : public BrowserProcess { | 41 class TestingBrowserProcess : public BrowserProcess { |
46 public: | 42 public: |
47 TestingBrowserProcess(); | 43 TestingBrowserProcess(); |
48 virtual ~TestingBrowserProcess(); | 44 virtual ~TestingBrowserProcess(); |
49 | 45 |
50 virtual void ResourceDispatcherHostCreated() OVERRIDE; | 46 virtual void ResourceDispatcherHostCreated() OVERRIDE; |
51 virtual void EndSession() OVERRIDE; | 47 virtual void EndSession() OVERRIDE; |
52 virtual MetricsService* metrics_service() OVERRIDE; | 48 virtual MetricsService* metrics_service() OVERRIDE; |
53 virtual IOThread* io_thread() OVERRIDE; | 49 virtual IOThread* io_thread() OVERRIDE; |
54 virtual WatchDogThread* watchdog_thread() OVERRIDE; | 50 virtual WatchDogThread* watchdog_thread() OVERRIDE; |
55 virtual ProfileManager* profile_manager() OVERRIDE; | 51 virtual ProfileManager* profile_manager() OVERRIDE; |
56 virtual PrefService* local_state() OVERRIDE; | 52 virtual PrefService* local_state() OVERRIDE; |
57 virtual chrome_variations::VariationsService* variations_service() OVERRIDE; | 53 virtual chrome_variations::VariationsService* variations_service() OVERRIDE; |
58 virtual policy::BrowserPolicyConnector* browser_policy_connector() OVERRIDE; | 54 virtual policy::BrowserPolicyConnector* browser_policy_connector() OVERRIDE; |
59 virtual policy::PolicyService* policy_service() OVERRIDE; | 55 virtual policy::PolicyService* policy_service() OVERRIDE; |
60 virtual IconManager* icon_manager() OVERRIDE; | 56 virtual IconManager* icon_manager() OVERRIDE; |
61 virtual ThumbnailGenerator* GetThumbnailGenerator() OVERRIDE; | 57 virtual ThumbnailGenerator* GetThumbnailGenerator() OVERRIDE; |
62 virtual BackgroundModeManager* background_mode_manager() OVERRIDE; | 58 virtual BackgroundModeManager* background_mode_manager() OVERRIDE; |
63 virtual StatusTray* status_tray() OVERRIDE; | 59 virtual StatusTray* status_tray() OVERRIDE; |
64 virtual SafeBrowsingService* safe_browsing_service() OVERRIDE; | 60 virtual SafeBrowsingService* safe_browsing_service() OVERRIDE; |
65 virtual safe_browsing::ClientSideDetectionService* | 61 virtual safe_browsing::ClientSideDetectionService* |
66 safe_browsing_detection_service() OVERRIDE; | 62 safe_browsing_detection_service() OVERRIDE; |
67 virtual net::URLRequestContextGetter* system_request_context() OVERRIDE; | 63 virtual net::URLRequestContextGetter* system_request_context() OVERRIDE; |
68 | 64 |
69 #if defined(OS_CHROMEOS) | 65 #if defined(OS_CHROMEOS) |
70 virtual chromeos::OomPriorityManager* oom_priority_manager() OVERRIDE; | 66 virtual chromeos::OomPriorityManager* oom_priority_manager() OVERRIDE; |
71 #endif // defined(OS_CHROMEOS) | 67 #endif // defined(OS_CHROMEOS) |
72 | 68 |
73 virtual ui::Clipboard* clipboard() OVERRIDE; | |
74 virtual extensions::EventRouterForwarder* | 69 virtual extensions::EventRouterForwarder* |
75 extension_event_router_forwarder() OVERRIDE; | 70 extension_event_router_forwarder() OVERRIDE; |
76 virtual NotificationUIManager* notification_ui_manager() OVERRIDE; | 71 virtual NotificationUIManager* notification_ui_manager() OVERRIDE; |
77 virtual IntranetRedirectDetector* intranet_redirect_detector() OVERRIDE; | 72 virtual IntranetRedirectDetector* intranet_redirect_detector() OVERRIDE; |
78 virtual AutomationProviderList* GetAutomationProviderList() OVERRIDE; | 73 virtual AutomationProviderList* GetAutomationProviderList() OVERRIDE; |
79 virtual void CreateDevToolsHttpProtocolHandler( | 74 virtual void CreateDevToolsHttpProtocolHandler( |
80 Profile* profile, | 75 Profile* profile, |
81 const std::string& ip, | 76 const std::string& ip, |
82 int port, | 77 int port, |
83 const std::string& frontend_url) OVERRIDE; | 78 const std::string& frontend_url) OVERRIDE; |
(...skipping 24 matching lines...) Expand all Loading... |
108 // afterwards (using ScopedTestingLocalState, for example). | 103 // afterwards (using ScopedTestingLocalState, for example). |
109 void SetLocalState(PrefService* local_state); | 104 void SetLocalState(PrefService* local_state); |
110 void SetProfileManager(ProfileManager* profile_manager); | 105 void SetProfileManager(ProfileManager* profile_manager); |
111 void SetIOThread(IOThread* io_thread); | 106 void SetIOThread(IOThread* io_thread); |
112 void SetBrowserPolicyConnector(policy::BrowserPolicyConnector* connector); | 107 void SetBrowserPolicyConnector(policy::BrowserPolicyConnector* connector); |
113 void SetSafeBrowsingService(SafeBrowsingService* sb_service); | 108 void SetSafeBrowsingService(SafeBrowsingService* sb_service); |
114 | 109 |
115 private: | 110 private: |
116 scoped_ptr<content::NotificationService> notification_service_; | 111 scoped_ptr<content::NotificationService> notification_service_; |
117 unsigned int module_ref_count_; | 112 unsigned int module_ref_count_; |
118 scoped_ptr<ui::Clipboard> clipboard_; | |
119 std::string app_locale_; | 113 std::string app_locale_; |
120 | 114 |
121 // Weak pointer. | 115 // Weak pointer. |
122 PrefService* local_state_; | 116 PrefService* local_state_; |
123 scoped_ptr<policy::BrowserPolicyConnector> browser_policy_connector_; | 117 scoped_ptr<policy::BrowserPolicyConnector> browser_policy_connector_; |
124 scoped_ptr<policy::PolicyService> policy_service_; | 118 scoped_ptr<policy::PolicyService> policy_service_; |
125 scoped_ptr<ProfileManager> profile_manager_; | 119 scoped_ptr<ProfileManager> profile_manager_; |
126 scoped_ptr<NotificationUIManager> notification_ui_manager_; | 120 scoped_ptr<NotificationUIManager> notification_ui_manager_; |
127 scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_; | 121 scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_; |
128 scoped_refptr<printing::PrintPreviewTabController> | 122 scoped_refptr<printing::PrintPreviewTabController> |
129 print_preview_tab_controller_; | 123 print_preview_tab_controller_; |
130 scoped_ptr<prerender::PrerenderTracker> prerender_tracker_; | 124 scoped_ptr<prerender::PrerenderTracker> prerender_tracker_; |
131 IOThread* io_thread_; | 125 IOThread* io_thread_; |
132 scoped_refptr<SafeBrowsingService> sb_service_; | 126 scoped_refptr<SafeBrowsingService> sb_service_; |
133 | 127 |
134 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); | 128 DISALLOW_COPY_AND_ASSIGN(TestingBrowserProcess); |
135 }; | 129 }; |
136 | 130 |
137 #endif // CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ | 131 #endif // CHROME_TEST_BASE_TESTING_BROWSER_PROCESS_H_ |
OLD | NEW |