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 #ifndef CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <memory> | 10 #include <memory> |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 void GetAudioOutputControllers( | 140 void GetAudioOutputControllers( |
141 const GetAudioOutputControllersCallback& callback) const override {} | 141 const GetAudioOutputControllersCallback& callback) const override {} |
142 | 142 |
143 void SetRemoteInterfaces( | 143 void SetRemoteInterfaces( |
144 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces) { | 144 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces) { |
145 remote_interfaces_ = std::move(remote_interfaces); | 145 remote_interfaces_ = std::move(remote_interfaces); |
146 } | 146 } |
147 | 147 |
| 148 void SetAudioStateChangedCallback(base::Closure closure) { |
| 149 audio_state_changed_callback_ = closure; |
| 150 } |
| 151 |
148 private: | 152 private: |
149 // Stores IPC messages that would have been sent to the renderer. | 153 // Stores IPC messages that would have been sent to the renderer. |
150 IPC::TestSink sink_; | 154 IPC::TestSink sink_; |
151 int bad_msg_count_; | 155 int bad_msg_count_; |
152 const MockRenderProcessHostFactory* factory_; | 156 const MockRenderProcessHostFactory* factory_; |
153 int id_; | 157 int id_; |
154 bool has_connection_; | 158 bool has_connection_; |
155 BrowserContext* browser_context_; | 159 BrowserContext* browser_context_; |
156 base::ObserverList<RenderProcessHostObserver> observers_; | 160 base::ObserverList<RenderProcessHostObserver> observers_; |
157 | 161 |
158 IDMap<RenderWidgetHost*> render_widget_hosts_; | 162 IDMap<RenderWidgetHost*> render_widget_hosts_; |
159 int prev_routing_id_; | 163 int prev_routing_id_; |
160 IDMap<IPC::Listener*> listeners_; | 164 IDMap<IPC::Listener*> listeners_; |
161 bool fast_shutdown_started_; | 165 bool fast_shutdown_started_; |
162 bool deletion_callback_called_; | 166 bool deletion_callback_called_; |
163 bool is_for_guests_only_; | 167 bool is_for_guests_only_; |
164 bool is_process_backgrounded_; | 168 bool is_process_backgrounded_; |
165 std::unique_ptr<base::ProcessHandle> process_handle; | 169 std::unique_ptr<base::ProcessHandle> process_handle; |
166 int worker_ref_count_; | 170 int worker_ref_count_; |
167 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_; | 171 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_; |
168 std::unique_ptr<mojo::AssociatedInterfacePtr<mojom::Renderer>> | 172 std::unique_ptr<mojo::AssociatedInterfacePtr<mojom::Renderer>> |
169 renderer_interface_; | 173 renderer_interface_; |
| 174 base::Closure audio_state_changed_callback_; |
170 | 175 |
171 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); | 176 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); |
172 }; | 177 }; |
173 | 178 |
174 class MockRenderProcessHostFactory : public RenderProcessHostFactory { | 179 class MockRenderProcessHostFactory : public RenderProcessHostFactory { |
175 public: | 180 public: |
176 MockRenderProcessHostFactory(); | 181 MockRenderProcessHostFactory(); |
177 ~MockRenderProcessHostFactory() override; | 182 ~MockRenderProcessHostFactory() override; |
178 | 183 |
179 RenderProcessHost* CreateRenderProcessHost( | 184 RenderProcessHost* CreateRenderProcessHost( |
(...skipping 10 matching lines...) Expand all Loading... |
190 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 195 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
191 // the destructor and prevent them from being leaked. | 196 // the destructor and prevent them from being leaked. |
192 mutable ScopedVector<MockRenderProcessHost> processes_; | 197 mutable ScopedVector<MockRenderProcessHost> processes_; |
193 | 198 |
194 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 199 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
195 }; | 200 }; |
196 | 201 |
197 } // namespace content | 202 } // namespace content |
198 | 203 |
199 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 204 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
OLD | NEW |