| 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> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void Resume() override; | 124 void Resume() override; |
| 125 mojom::Renderer* GetRendererInterface() override; | 125 mojom::Renderer* GetRendererInterface() override; |
| 126 resource_coordinator::ResourceCoordinatorInterface* | 126 resource_coordinator::ResourceCoordinatorInterface* |
| 127 GetProcessResourceCoordinator() override; | 127 GetProcessResourceCoordinator() override; |
| 128 | 128 |
| 129 void SetIsNeverSuitableForReuse() override; | 129 void SetIsNeverSuitableForReuse() override; |
| 130 bool MayReuseHost() override; | 130 bool MayReuseHost() override; |
| 131 bool IsUnused() override; | 131 bool IsUnused() override; |
| 132 void SetIsUsed() override; | 132 void SetIsUsed() override; |
| 133 | 133 |
| 134 bool HostHasNotBeenUsed() override; |
| 135 |
| 134 // IPC::Sender via RenderProcessHost. | 136 // IPC::Sender via RenderProcessHost. |
| 135 bool Send(IPC::Message* msg) override; | 137 bool Send(IPC::Message* msg) override; |
| 136 | 138 |
| 137 // IPC::Listener via RenderProcessHost. | 139 // IPC::Listener via RenderProcessHost. |
| 138 bool OnMessageReceived(const IPC::Message& msg) override; | 140 bool OnMessageReceived(const IPC::Message& msg) override; |
| 139 void OnChannelConnected(int32_t peer_pid) override; | 141 void OnChannelConnected(int32_t peer_pid) override; |
| 140 | 142 |
| 141 // Attaches the factory object so we can remove this object in its destructor | 143 // Attaches the factory object so we can remove this object in its destructor |
| 142 // and prevent MockRenderProcessHostFacotry from deleting it. | 144 // and prevent MockRenderProcessHostFacotry from deleting it. |
| 143 void SetFactory(const MockRenderProcessHostFactory* factory) { | 145 void SetFactory(const MockRenderProcessHostFactory* factory) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 ~MockRenderProcessHostFactory() override; | 195 ~MockRenderProcessHostFactory() override; |
| 194 | 196 |
| 195 RenderProcessHost* CreateRenderProcessHost( | 197 RenderProcessHost* CreateRenderProcessHost( |
| 196 BrowserContext* browser_context) const override; | 198 BrowserContext* browser_context) const override; |
| 197 | 199 |
| 198 // Removes the given MockRenderProcessHost from the MockRenderProcessHost list | 200 // Removes the given MockRenderProcessHost from the MockRenderProcessHost list |
| 199 // without deleting it. When a test deletes a MockRenderProcessHost, we need | 201 // without deleting it. When a test deletes a MockRenderProcessHost, we need |
| 200 // to remove it from |processes_| to prevent it from being deleted twice. | 202 // to remove it from |processes_| to prevent it from being deleted twice. |
| 201 void Remove(MockRenderProcessHost* host) const; | 203 void Remove(MockRenderProcessHost* host) const; |
| 202 | 204 |
| 205 // Retrieve the current list of mock processes. |
| 206 std::vector<std::unique_ptr<MockRenderProcessHost>>* GetProcesses() { |
| 207 return &processes_; |
| 208 } |
| 209 |
| 203 private: | 210 private: |
| 204 // A list of MockRenderProcessHosts created by this object. This list is used | 211 // A list of MockRenderProcessHosts created by this object. This list is used |
| 205 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 212 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
| 206 // the destructor and prevent them from being leaked. | 213 // the destructor and prevent them from being leaked. |
| 207 mutable std::vector<std::unique_ptr<MockRenderProcessHost>> processes_; | 214 mutable std::vector<std::unique_ptr<MockRenderProcessHost>> processes_; |
| 208 | 215 |
| 209 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 216 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
| 210 }; | 217 }; |
| 211 | 218 |
| 212 } // namespace content | 219 } // namespace content |
| 213 | 220 |
| 214 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 221 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
| OLD | NEW |