| 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 |
| 10 #include <memory> | 11 #include <memory> |
| 12 #include <string> |
| 11 #include <utility> | 13 #include <utility> |
| 12 | 14 |
| 13 #include "base/macros.h" | 15 #include "base/macros.h" |
| 14 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
| 15 #include "base/metrics/persistent_memory_allocator.h" | 17 #include "base/metrics/persistent_memory_allocator.h" |
| 16 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 17 #include "content/public/browser/render_process_host.h" | 19 #include "content/public/browser/render_process_host.h" |
| 18 #include "content/public/browser/render_process_host_factory.h" | 20 #include "content/public/browser/render_process_host_factory.h" |
| 19 #include "ipc/ipc_test_sink.h" | 21 #include "ipc/ipc_test_sink.h" |
| 20 #include "media/media_features.h" | 22 #include "media/media_features.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 142 } |
| 141 | 143 |
| 142 void GetAudioOutputControllers( | 144 void GetAudioOutputControllers( |
| 143 const GetAudioOutputControllersCallback& callback) const override {} | 145 const GetAudioOutputControllersCallback& callback) const override {} |
| 144 | 146 |
| 145 void SetRemoteInterfaces( | 147 void SetRemoteInterfaces( |
| 146 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces) { | 148 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces) { |
| 147 remote_interfaces_ = std::move(remote_interfaces); | 149 remote_interfaces_ = std::move(remote_interfaces); |
| 148 } | 150 } |
| 149 | 151 |
| 152 void SetAudioStateChangedCallback(base::Closure closure) { |
| 153 audio_state_changed_callback_ = closure; |
| 154 } |
| 155 |
| 150 private: | 156 private: |
| 151 // Stores IPC messages that would have been sent to the renderer. | 157 // Stores IPC messages that would have been sent to the renderer. |
| 152 IPC::TestSink sink_; | 158 IPC::TestSink sink_; |
| 153 int bad_msg_count_; | 159 int bad_msg_count_; |
| 154 const MockRenderProcessHostFactory* factory_; | 160 const MockRenderProcessHostFactory* factory_; |
| 155 int id_; | 161 int id_; |
| 156 bool has_connection_; | 162 bool has_connection_; |
| 157 BrowserContext* browser_context_; | 163 BrowserContext* browser_context_; |
| 158 base::ObserverList<RenderProcessHostObserver> observers_; | 164 base::ObserverList<RenderProcessHostObserver> observers_; |
| 159 | 165 |
| 160 IDMap<RenderWidgetHost*> render_widget_hosts_; | 166 IDMap<RenderWidgetHost*> render_widget_hosts_; |
| 161 int prev_routing_id_; | 167 int prev_routing_id_; |
| 162 IDMap<IPC::Listener*> listeners_; | 168 IDMap<IPC::Listener*> listeners_; |
| 163 bool fast_shutdown_started_; | 169 bool fast_shutdown_started_; |
| 164 bool deletion_callback_called_; | 170 bool deletion_callback_called_; |
| 165 bool is_for_guests_only_; | 171 bool is_for_guests_only_; |
| 166 bool is_process_backgrounded_; | 172 bool is_process_backgrounded_; |
| 167 std::unique_ptr<base::ProcessHandle> process_handle; | 173 std::unique_ptr<base::ProcessHandle> process_handle; |
| 168 int worker_ref_count_; | 174 int worker_ref_count_; |
| 169 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_; | 175 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_; |
| 170 std::unique_ptr<mojo::AssociatedInterfacePtr<mojom::Renderer>> | 176 std::unique_ptr<mojo::AssociatedInterfacePtr<mojom::Renderer>> |
| 171 renderer_interface_; | 177 renderer_interface_; |
| 178 base::Closure audio_state_changed_callback_; |
| 172 | 179 |
| 173 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); | 180 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); |
| 174 }; | 181 }; |
| 175 | 182 |
| 176 class MockRenderProcessHostFactory : public RenderProcessHostFactory { | 183 class MockRenderProcessHostFactory : public RenderProcessHostFactory { |
| 177 public: | 184 public: |
| 178 MockRenderProcessHostFactory(); | 185 MockRenderProcessHostFactory(); |
| 179 ~MockRenderProcessHostFactory() override; | 186 ~MockRenderProcessHostFactory() override; |
| 180 | 187 |
| 181 RenderProcessHost* CreateRenderProcessHost( | 188 RenderProcessHost* CreateRenderProcessHost( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 192 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 199 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
| 193 // the destructor and prevent them from being leaked. | 200 // the destructor and prevent them from being leaked. |
| 194 mutable ScopedVector<MockRenderProcessHost> processes_; | 201 mutable ScopedVector<MockRenderProcessHost> processes_; |
| 195 | 202 |
| 196 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 203 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
| 197 }; | 204 }; |
| 198 | 205 |
| 199 } // namespace content | 206 } // namespace content |
| 200 | 207 |
| 201 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 208 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
| OLD | NEW |