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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 ~MockRenderProcessHostFactory() override; | 190 ~MockRenderProcessHostFactory() override; |
191 | 191 |
192 RenderProcessHost* CreateRenderProcessHost( | 192 RenderProcessHost* CreateRenderProcessHost( |
193 BrowserContext* browser_context) const override; | 193 BrowserContext* browser_context) const override; |
194 | 194 |
195 // Removes the given MockRenderProcessHost from the MockRenderProcessHost list | 195 // Removes the given MockRenderProcessHost from the MockRenderProcessHost list |
196 // without deleting it. When a test deletes a MockRenderProcessHost, we need | 196 // without deleting it. When a test deletes a MockRenderProcessHost, we need |
197 // to remove it from |processes_| to prevent it from being deleted twice. | 197 // to remove it from |processes_| to prevent it from being deleted twice. |
198 void Remove(MockRenderProcessHost* host) const; | 198 void Remove(MockRenderProcessHost* host) const; |
199 | 199 |
| 200 // Retrieve the current list of mock processes. |
| 201 std::vector<std::unique_ptr<MockRenderProcessHost>>* GetProcesses() { |
| 202 return &processes_; |
| 203 } |
| 204 |
200 private: | 205 private: |
201 // A list of MockRenderProcessHosts created by this object. This list is used | 206 // A list of MockRenderProcessHosts created by this object. This list is used |
202 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 207 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
203 // the destructor and prevent them from being leaked. | 208 // the destructor and prevent them from being leaked. |
204 mutable std::vector<std::unique_ptr<MockRenderProcessHost>> processes_; | 209 mutable std::vector<std::unique_ptr<MockRenderProcessHost>> processes_; |
205 | 210 |
206 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 211 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
207 }; | 212 }; |
208 | 213 |
209 } // namespace content | 214 } // namespace content |
210 | 215 |
211 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 216 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
OLD | NEW |