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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); | 105 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); |
106 }; | 106 }; |
107 | 107 |
108 class MockRenderProcessHostFactory : public RenderProcessHostFactory { | 108 class MockRenderProcessHostFactory : public RenderProcessHostFactory { |
109 public: | 109 public: |
110 MockRenderProcessHostFactory(); | 110 MockRenderProcessHostFactory(); |
111 virtual ~MockRenderProcessHostFactory(); | 111 virtual ~MockRenderProcessHostFactory(); |
112 | 112 |
113 virtual RenderProcessHost* CreateRenderProcessHost( | 113 virtual RenderProcessHost* CreateRenderProcessHost( |
114 BrowserContext* browser_context) const OVERRIDE; | 114 BrowserContext* browser_context, |
| 115 SiteInstance* site_instance) const OVERRIDE; |
115 | 116 |
116 // Removes the given MockRenderProcessHost from the MockRenderProcessHost list | 117 // Removes the given MockRenderProcessHost from the MockRenderProcessHost list |
117 // without deleting it. When a test deletes a MockRenderProcessHost, we need | 118 // without deleting it. When a test deletes a MockRenderProcessHost, we need |
118 // to remove it from |processes_| to prevent it from being deleted twice. | 119 // to remove it from |processes_| to prevent it from being deleted twice. |
119 void Remove(MockRenderProcessHost* host) const; | 120 void Remove(MockRenderProcessHost* host) const; |
120 | 121 |
121 private: | 122 private: |
122 // A list of MockRenderProcessHosts created by this object. This list is used | 123 // A list of MockRenderProcessHosts created by this object. This list is used |
123 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 124 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
124 // the destructor and prevent them from being leaked. | 125 // the destructor and prevent them from being leaked. |
125 mutable ScopedVector<MockRenderProcessHost> processes_; | 126 mutable ScopedVector<MockRenderProcessHost> processes_; |
126 | 127 |
127 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 128 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
128 }; | 129 }; |
129 | 130 |
130 } // namespace content | 131 } // namespace content |
131 | 132 |
132 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 133 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
OLD | NEW |