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 "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void SetFactory(const MockRenderProcessHostFactory* factory) { | 96 void SetFactory(const MockRenderProcessHostFactory* factory) { |
97 factory_ = factory; | 97 factory_ = factory; |
98 } | 98 } |
99 | 99 |
100 int GetActiveViewCount(); | 100 int GetActiveViewCount(); |
101 | 101 |
102 void set_is_isolated_guest(bool is_isolated_guest) { | 102 void set_is_isolated_guest(bool is_isolated_guest) { |
103 is_isolated_guest_ = is_isolated_guest; | 103 is_isolated_guest_ = is_isolated_guest; |
104 } | 104 } |
105 | 105 |
| 106 void SetProcessHandle(scoped_ptr<base::ProcessHandle> new_handle) { |
| 107 process_handle = new_handle.Pass(); |
| 108 } |
| 109 |
106 private: | 110 private: |
107 // Stores IPC messages that would have been sent to the renderer. | 111 // Stores IPC messages that would have been sent to the renderer. |
108 IPC::TestSink sink_; | 112 IPC::TestSink sink_; |
109 int bad_msg_count_; | 113 int bad_msg_count_; |
110 const MockRenderProcessHostFactory* factory_; | 114 const MockRenderProcessHostFactory* factory_; |
111 int id_; | 115 int id_; |
112 BrowserContext* browser_context_; | 116 BrowserContext* browser_context_; |
113 ObserverList<RenderProcessHostObserver> observers_; | 117 ObserverList<RenderProcessHostObserver> observers_; |
114 | 118 |
115 IDMap<RenderWidgetHost> render_widget_hosts_; | 119 IDMap<RenderWidgetHost> render_widget_hosts_; |
116 int prev_routing_id_; | 120 int prev_routing_id_; |
117 IDMap<IPC::Listener> listeners_; | 121 IDMap<IPC::Listener> listeners_; |
118 bool fast_shutdown_started_; | 122 bool fast_shutdown_started_; |
119 bool deletion_callback_called_; | 123 bool deletion_callback_called_; |
120 bool is_isolated_guest_; | 124 bool is_isolated_guest_; |
| 125 scoped_ptr<base::ProcessHandle> process_handle; |
121 | 126 |
122 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); | 127 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); |
123 }; | 128 }; |
124 | 129 |
125 class MockRenderProcessHostFactory : public RenderProcessHostFactory { | 130 class MockRenderProcessHostFactory : public RenderProcessHostFactory { |
126 public: | 131 public: |
127 MockRenderProcessHostFactory(); | 132 MockRenderProcessHostFactory(); |
128 virtual ~MockRenderProcessHostFactory(); | 133 virtual ~MockRenderProcessHostFactory(); |
129 | 134 |
130 virtual RenderProcessHost* CreateRenderProcessHost( | 135 virtual RenderProcessHost* CreateRenderProcessHost( |
(...skipping 10 matching lines...) Expand all Loading... |
141 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 146 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
142 // the destructor and prevent them from being leaked. | 147 // the destructor and prevent them from being leaked. |
143 mutable ScopedVector<MockRenderProcessHost> processes_; | 148 mutable ScopedVector<MockRenderProcessHost> processes_; |
144 | 149 |
145 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 150 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
146 }; | 151 }; |
147 | 152 |
148 } // namespace content | 153 } // namespace content |
149 | 154 |
150 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 155 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
OLD | NEW |