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