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