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 <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "base/metrics/persistent_memory_allocator.h" | 14 #include "base/metrics/persistent_memory_allocator.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 |
16 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
17 #include "content/public/browser/render_process_host_factory.h" | 18 #include "content/public/browser/render_process_host_factory.h" |
18 #include "content/public/common/service_registry.h" | 19 #include "content/public/common/service_registry.h" |
19 #include "ipc/ipc_test_sink.h" | 20 #include "ipc/ipc_test_sink.h" |
20 | 21 |
21 class StoragePartition; | 22 class StoragePartition; |
22 | 23 |
23 namespace content { | 24 namespace content { |
| 25 class AudioRendererHost; |
24 | 26 |
25 class MockRenderProcessHostFactory; | 27 class MockRenderProcessHostFactory; |
26 | 28 |
27 // A mock render process host that has no corresponding renderer process. All | 29 // A mock render process host that has no corresponding renderer process. All |
28 // IPC messages are sent into the message sink for inspection by tests. | 30 // IPC messages are sent into the message sink for inspection by tests. |
29 class MockRenderProcessHost : public RenderProcessHost { | 31 class MockRenderProcessHost : public RenderProcessHost { |
30 public: | 32 public: |
31 explicit MockRenderProcessHost(BrowserContext* browser_context); | 33 explicit MockRenderProcessHost(BrowserContext* browser_context); |
32 ~MockRenderProcessHost() override; | 34 ~MockRenderProcessHost() override; |
33 | 35 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void DecrementWorkerRefCount() override; | 109 void DecrementWorkerRefCount() override; |
108 void PurgeAndSuspend() override; | 110 void PurgeAndSuspend() override; |
109 | 111 |
110 // IPC::Sender via RenderProcessHost. | 112 // IPC::Sender via RenderProcessHost. |
111 bool Send(IPC::Message* msg) override; | 113 bool Send(IPC::Message* msg) override; |
112 | 114 |
113 // IPC::Listener via RenderProcessHost. | 115 // IPC::Listener via RenderProcessHost. |
114 bool OnMessageReceived(const IPC::Message& msg) override; | 116 bool OnMessageReceived(const IPC::Message& msg) override; |
115 void OnChannelConnected(int32_t peer_pid) override; | 117 void OnChannelConnected(int32_t peer_pid) override; |
116 | 118 |
| 119 scoped_refptr<AudioRendererHost> audio_renderer_host() const override; |
| 120 |
117 // Attaches the factory object so we can remove this object in its destructor | 121 // Attaches the factory object so we can remove this object in its destructor |
118 // and prevent MockRenderProcessHostFacotry from deleting it. | 122 // and prevent MockRenderProcessHostFacotry from deleting it. |
119 void SetFactory(const MockRenderProcessHostFactory* factory) { | 123 void SetFactory(const MockRenderProcessHostFactory* factory) { |
120 factory_ = factory; | 124 factory_ = factory; |
121 } | 125 } |
122 | 126 |
123 void set_is_for_guests_only(bool is_for_guests_only) { | 127 void set_is_for_guests_only(bool is_for_guests_only) { |
124 is_for_guests_only_ = is_for_guests_only; | 128 is_for_guests_only_ = is_for_guests_only; |
125 } | 129 } |
126 | 130 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 188 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
185 // the destructor and prevent them from being leaked. | 189 // the destructor and prevent them from being leaked. |
186 mutable ScopedVector<MockRenderProcessHost> processes_; | 190 mutable ScopedVector<MockRenderProcessHost> processes_; |
187 | 191 |
188 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 192 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
189 }; | 193 }; |
190 | 194 |
191 } // namespace content | 195 } // namespace content |
192 | 196 |
193 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 197 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
OLD | NEW |