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 <utility> | 11 #include <utility> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
14 #include "base/metrics/persistent_memory_allocator.h" | 15 #include "base/metrics/persistent_memory_allocator.h" |
15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
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 "ipc/ipc_test_sink.h" | 19 #include "ipc/ipc_test_sink.h" |
19 #include "services/shell/public/cpp/interface_provider.h" | 20 #include "services/shell/public/cpp/interface_provider.h" |
20 #include "services/shell/public/cpp/interface_registry.h" | 21 #include "services/shell/public/cpp/interface_registry.h" |
21 | 22 |
22 class StoragePartition; | 23 class StoragePartition; |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 | 26 |
26 class MockRenderProcessHostFactory; | 27 class MockRenderProcessHostFactory; |
| 28 class OwnedInterface; |
27 | 29 |
28 // A mock render process host that has no corresponding renderer process. All | 30 // A mock render process host that has no corresponding renderer process. All |
29 // IPC messages are sent into the message sink for inspection by tests. | 31 // IPC messages are sent into the message sink for inspection by tests. |
30 class MockRenderProcessHost : public RenderProcessHost { | 32 class MockRenderProcessHost : public RenderProcessHost { |
31 public: | 33 public: |
32 explicit MockRenderProcessHost(BrowserContext* browser_context); | 34 explicit MockRenderProcessHost(BrowserContext* browser_context); |
33 ~MockRenderProcessHost() override; | 35 ~MockRenderProcessHost() override; |
34 | 36 |
35 // Provides access to all IPC messages that would have been sent to the | 37 // Provides access to all IPC messages that would have been sent to the |
36 // renderer via this RenderProcessHost. | 38 // renderer via this RenderProcessHost. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 bool IgnoreInputEvents() const override; | 71 bool IgnoreInputEvents() const override; |
70 void Cleanup() override; | 72 void Cleanup() override; |
71 void AddPendingView() override; | 73 void AddPendingView() override; |
72 void RemovePendingView() override; | 74 void RemovePendingView() override; |
73 void SetSuddenTerminationAllowed(bool allowed) override; | 75 void SetSuddenTerminationAllowed(bool allowed) override; |
74 bool SuddenTerminationAllowed() const override; | 76 bool SuddenTerminationAllowed() const override; |
75 BrowserContext* GetBrowserContext() const override; | 77 BrowserContext* GetBrowserContext() const override; |
76 bool InSameStoragePartition(StoragePartition* partition) const override; | 78 bool InSameStoragePartition(StoragePartition* partition) const override; |
77 IPC::ChannelProxy* GetChannel() override; | 79 IPC::ChannelProxy* GetChannel() override; |
78 void AddFilter(BrowserMessageFilter* filter) override; | 80 void AddFilter(BrowserMessageFilter* filter) override; |
| 81 void AddOwnedInterface(std::unique_ptr<OwnedInterface> impl) override; |
79 bool FastShutdownForPageCount(size_t count) override; | 82 bool FastShutdownForPageCount(size_t count) override; |
80 base::TimeDelta GetChildProcessIdleTime() const override; | 83 base::TimeDelta GetChildProcessIdleTime() const override; |
81 void FilterURL(bool empty_allowed, GURL* url) override; | 84 void FilterURL(bool empty_allowed, GURL* url) override; |
82 #if defined(ENABLE_WEBRTC) | 85 #if defined(ENABLE_WEBRTC) |
83 void EnableAudioDebugRecordings(const base::FilePath& file) override; | 86 void EnableAudioDebugRecordings(const base::FilePath& file) override; |
84 void DisableAudioDebugRecordings() override; | 87 void DisableAudioDebugRecordings() override; |
85 bool StartWebRTCEventLog(const base::FilePath& file_path) override; | 88 bool StartWebRTCEventLog(const base::FilePath& file_path) override; |
86 bool StopWebRTCEventLog() override; | 89 bool StopWebRTCEventLog() override; |
87 void SetWebRtcLogMessageCallback( | 90 void SetWebRtcLogMessageCallback( |
88 base::Callback<void(const std::string&)> callback) override; | 91 base::Callback<void(const std::string&)> callback) override; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 194 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
192 // the destructor and prevent them from being leaked. | 195 // the destructor and prevent them from being leaked. |
193 mutable ScopedVector<MockRenderProcessHost> processes_; | 196 mutable ScopedVector<MockRenderProcessHost> processes_; |
194 | 197 |
195 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 198 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
196 }; | 199 }; |
197 | 200 |
198 } // namespace content | 201 } // namespace content |
199 | 202 |
200 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 203 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
OLD | NEW |