| 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> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/metrics/persistent_memory_allocator.h" | 15 #include "base/metrics/persistent_memory_allocator.h" |
| 16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
| 18 #include "content/public/browser/render_process_host_factory.h" | 18 #include "content/public/browser/render_process_host_factory.h" |
| 19 #include "ipc/ipc_test_sink.h" | 19 #include "ipc/ipc_test_sink.h" |
| 20 #include "media/media_features.h" | 20 #include "media/media_features.h" |
| 21 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" | 21 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
| 22 #include "services/service_manager/public/cpp/interface_provider.h" | 22 #include "services/service_manager/public/cpp/interface_provider.h" |
| 23 | 23 |
| 24 class StoragePartition; | 24 class StoragePartition; |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 | 27 |
| 28 class FakeAssociatedInterfaceProviderImpl; |
| 28 class MockRenderProcessHostFactory; | 29 class MockRenderProcessHostFactory; |
| 29 class RenderWidgetHost; | 30 class RenderWidgetHost; |
| 30 | 31 |
| 31 // A mock render process host that has no corresponding renderer process. All | 32 // A mock render process host that has no corresponding renderer process. All |
| 32 // IPC messages are sent into the message sink for inspection by tests. | 33 // IPC messages are sent into the message sink for inspection by tests. |
| 33 class MockRenderProcessHost : public RenderProcessHost { | 34 class MockRenderProcessHost : public RenderProcessHost { |
| 34 public: | 35 public: |
| 35 explicit MockRenderProcessHost(BrowserContext* browser_context); | 36 explicit MockRenderProcessHost(BrowserContext* browser_context); |
| 36 ~MockRenderProcessHost() override; | 37 ~MockRenderProcessHost() override; |
| 37 | 38 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 void SetWebRtcLogMessageCallback( | 91 void SetWebRtcLogMessageCallback( |
| 91 base::Callback<void(const std::string&)> callback) override; | 92 base::Callback<void(const std::string&)> callback) override; |
| 92 void ClearWebRtcLogMessageCallback() override; | 93 void ClearWebRtcLogMessageCallback() override; |
| 93 WebRtcStopRtpDumpCallback StartRtpDump( | 94 WebRtcStopRtpDumpCallback StartRtpDump( |
| 94 bool incoming, | 95 bool incoming, |
| 95 bool outgoing, | 96 bool outgoing, |
| 96 const WebRtcRtpPacketCallback& packet_callback) override; | 97 const WebRtcRtpPacketCallback& packet_callback) override; |
| 97 #endif | 98 #endif |
| 98 void ResumeDeferredNavigation(const GlobalRequestID& request_id) override; | 99 void ResumeDeferredNavigation(const GlobalRequestID& request_id) override; |
| 99 service_manager::InterfaceProvider* GetRemoteInterfaces() override; | 100 service_manager::InterfaceProvider* GetRemoteInterfaces() override; |
| 101 AssociatedInterfaceProvider* GetAssociatedInterfaceProviderForTesting() |
| 102 override; |
| 100 std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator() | 103 std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator() |
| 101 override; | 104 override; |
| 102 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override; | 105 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override; |
| 103 bool IsProcessBackgrounded() const override; | 106 bool IsProcessBackgrounded() const override; |
| 104 size_t GetWorkerRefCount() const override; | 107 size_t GetWorkerRefCount() const override; |
| 105 void IncrementServiceWorkerRefCount() override; | 108 void IncrementServiceWorkerRefCount() override; |
| 106 void DecrementServiceWorkerRefCount() override; | 109 void DecrementServiceWorkerRefCount() override; |
| 107 void IncrementSharedWorkerRefCount() override; | 110 void IncrementSharedWorkerRefCount() override; |
| 108 void DecrementSharedWorkerRefCount() override; | 111 void DecrementSharedWorkerRefCount() override; |
| 109 void ForceReleaseWorkerRefCounts() override; | 112 void ForceReleaseWorkerRefCounts() override; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 IDMap<RenderWidgetHost*> render_widget_hosts_; | 161 IDMap<RenderWidgetHost*> render_widget_hosts_; |
| 159 int prev_routing_id_; | 162 int prev_routing_id_; |
| 160 IDMap<IPC::Listener*> listeners_; | 163 IDMap<IPC::Listener*> listeners_; |
| 161 bool fast_shutdown_started_; | 164 bool fast_shutdown_started_; |
| 162 bool deletion_callback_called_; | 165 bool deletion_callback_called_; |
| 163 bool is_for_guests_only_; | 166 bool is_for_guests_only_; |
| 164 bool is_process_backgrounded_; | 167 bool is_process_backgrounded_; |
| 165 std::unique_ptr<base::ProcessHandle> process_handle; | 168 std::unique_ptr<base::ProcessHandle> process_handle; |
| 166 int worker_ref_count_; | 169 int worker_ref_count_; |
| 167 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_; | 170 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_; |
| 171 std::unique_ptr<FakeAssociatedInterfaceProviderImpl> |
| 172 fake_associated_interface_provider_; |
| 168 std::unique_ptr<mojo::AssociatedInterfacePtr<mojom::Renderer>> | 173 std::unique_ptr<mojo::AssociatedInterfacePtr<mojom::Renderer>> |
| 169 renderer_interface_; | 174 renderer_interface_; |
| 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; |
| (...skipping 12 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 |