| 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 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.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/identity.h" |
| 22 #include "services/service_manager/public/cpp/interface_provider.h" | 23 #include "services/service_manager/public/cpp/interface_provider.h" |
| 23 | 24 |
| 24 class StoragePartition; | 25 class StoragePartition; |
| 25 | 26 |
| 26 namespace content { | 27 namespace content { |
| 27 | 28 |
| 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 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 base::Callback<void(const std::string&)> callback) override; | 98 base::Callback<void(const std::string&)> callback) override; |
| 98 void ClearWebRtcLogMessageCallback() override; | 99 void ClearWebRtcLogMessageCallback() override; |
| 99 WebRtcStopRtpDumpCallback StartRtpDump( | 100 WebRtcStopRtpDumpCallback StartRtpDump( |
| 100 bool incoming, | 101 bool incoming, |
| 101 bool outgoing, | 102 bool outgoing, |
| 102 const WebRtcRtpPacketCallback& packet_callback) override; | 103 const WebRtcRtpPacketCallback& packet_callback) override; |
| 103 #endif | 104 #endif |
| 104 void ResumeDeferredNavigation(const GlobalRequestID& request_id) override; | 105 void ResumeDeferredNavigation(const GlobalRequestID& request_id) override; |
| 105 void BindInterface(const std::string& interface_name, | 106 void BindInterface(const std::string& interface_name, |
| 106 mojo::ScopedMessagePipeHandle interface_pipe) override; | 107 mojo::ScopedMessagePipeHandle interface_pipe) override; |
| 108 const service_manager::Identity& GetChildIdentity() const override; |
| 107 std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator() | 109 std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator() |
| 108 override; | 110 override; |
| 109 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override; | 111 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override; |
| 110 bool IsProcessBackgrounded() const override; | 112 bool IsProcessBackgrounded() const override; |
| 111 size_t GetWorkerRefCount() const override; | 113 size_t GetWorkerRefCount() const override; |
| 112 void IncrementServiceWorkerRefCount() override; | 114 void IncrementServiceWorkerRefCount() override; |
| 113 void DecrementServiceWorkerRefCount() override; | 115 void DecrementServiceWorkerRefCount() override; |
| 114 void IncrementSharedWorkerRefCount() override; | 116 void IncrementSharedWorkerRefCount() override; |
| 115 void DecrementSharedWorkerRefCount() override; | 117 void DecrementSharedWorkerRefCount() override; |
| 116 void ForceReleaseWorkerRefCounts() override; | 118 void ForceReleaseWorkerRefCounts() override; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 IDMap<IPC::Listener*> listeners_; | 166 IDMap<IPC::Listener*> listeners_; |
| 165 bool fast_shutdown_started_; | 167 bool fast_shutdown_started_; |
| 166 bool deletion_callback_called_; | 168 bool deletion_callback_called_; |
| 167 bool is_for_guests_only_; | 169 bool is_for_guests_only_; |
| 168 bool is_process_backgrounded_; | 170 bool is_process_backgrounded_; |
| 169 std::unique_ptr<base::ProcessHandle> process_handle; | 171 std::unique_ptr<base::ProcessHandle> process_handle; |
| 170 int worker_ref_count_; | 172 int worker_ref_count_; |
| 171 std::unique_ptr<mojo::AssociatedInterfacePtr<mojom::Renderer>> | 173 std::unique_ptr<mojo::AssociatedInterfacePtr<mojom::Renderer>> |
| 172 renderer_interface_; | 174 renderer_interface_; |
| 173 std::map<std::string, InterfaceBinder> binder_overrides_; | 175 std::map<std::string, InterfaceBinder> binder_overrides_; |
| 176 service_manager::Identity child_identity_; |
| 174 | 177 |
| 175 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); | 178 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); |
| 176 }; | 179 }; |
| 177 | 180 |
| 178 class MockRenderProcessHostFactory : public RenderProcessHostFactory { | 181 class MockRenderProcessHostFactory : public RenderProcessHostFactory { |
| 179 public: | 182 public: |
| 180 MockRenderProcessHostFactory(); | 183 MockRenderProcessHostFactory(); |
| 181 ~MockRenderProcessHostFactory() override; | 184 ~MockRenderProcessHostFactory() override; |
| 182 | 185 |
| 183 RenderProcessHost* CreateRenderProcessHost( | 186 RenderProcessHost* CreateRenderProcessHost( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 194 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 197 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
| 195 // the destructor and prevent them from being leaked. | 198 // the destructor and prevent them from being leaked. |
| 196 mutable std::vector<std::unique_ptr<MockRenderProcessHost>> processes_; | 199 mutable std::vector<std::unique_ptr<MockRenderProcessHost>> processes_; |
| 197 | 200 |
| 198 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 201 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
| 199 }; | 202 }; |
| 200 | 203 |
| 201 } // namespace content | 204 } // namespace content |
| 202 | 205 |
| 203 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 206 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
| OLD | NEW |