| 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" |
| 11 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
| 12 #include "content/public/browser/render_process_host_factory.h" | 12 #include "content/public/browser/render_process_host_factory.h" |
| 13 #include "ipc/ipc_test_sink.h" | 13 #include "ipc/ipc_test_sink.h" |
| 14 | 14 |
| 15 class StoragePartition; | 15 class StoragePartition; |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 class MockRenderProcessHostFactory; | 19 class MockRenderProcessHostFactory; |
| 20 class ServiceRegistryImpl; |
| 20 | 21 |
| 21 // A mock render process host that has no corresponding renderer process. All | 22 // A mock render process host that has no corresponding renderer process. All |
| 22 // IPC messages are sent into the message sink for inspection by tests. | 23 // IPC messages are sent into the message sink for inspection by tests. |
| 23 class MockRenderProcessHost : public RenderProcessHost { | 24 class MockRenderProcessHost : public RenderProcessHost { |
| 24 public: | 25 public: |
| 25 explicit MockRenderProcessHost(BrowserContext* browser_context); | 26 explicit MockRenderProcessHost(BrowserContext* browser_context); |
| 26 ~MockRenderProcessHost() override; | 27 ~MockRenderProcessHost() override; |
| 27 | 28 |
| 28 // Provides access to all IPC messages that would have been sent to the | 29 // Provides access to all IPC messages that would have been sent to the |
| 29 // renderer via this RenderProcessHost. | 30 // renderer via this RenderProcessHost. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 BrowserContext* browser_context_; | 130 BrowserContext* browser_context_; |
| 130 base::ObserverList<RenderProcessHostObserver> observers_; | 131 base::ObserverList<RenderProcessHostObserver> observers_; |
| 131 | 132 |
| 132 IDMap<RenderWidgetHost> render_widget_hosts_; | 133 IDMap<RenderWidgetHost> render_widget_hosts_; |
| 133 int prev_routing_id_; | 134 int prev_routing_id_; |
| 134 IDMap<IPC::Listener> listeners_; | 135 IDMap<IPC::Listener> listeners_; |
| 135 bool fast_shutdown_started_; | 136 bool fast_shutdown_started_; |
| 136 bool deletion_callback_called_; | 137 bool deletion_callback_called_; |
| 137 bool is_for_guests_only_; | 138 bool is_for_guests_only_; |
| 138 scoped_ptr<base::ProcessHandle> process_handle; | 139 scoped_ptr<base::ProcessHandle> process_handle; |
| 140 scoped_ptr<ServiceRegistryImpl> service_registry_; |
| 139 | 141 |
| 140 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); | 142 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); |
| 141 }; | 143 }; |
| 142 | 144 |
| 143 class MockRenderProcessHostFactory : public RenderProcessHostFactory { | 145 class MockRenderProcessHostFactory : public RenderProcessHostFactory { |
| 144 public: | 146 public: |
| 145 MockRenderProcessHostFactory(); | 147 MockRenderProcessHostFactory(); |
| 146 ~MockRenderProcessHostFactory() override; | 148 ~MockRenderProcessHostFactory() override; |
| 147 | 149 |
| 148 RenderProcessHost* CreateRenderProcessHost( | 150 RenderProcessHost* CreateRenderProcessHost( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 159 // for deleting all MockRenderProcessHosts that have not deleted by a test in | 161 // for deleting all MockRenderProcessHosts that have not deleted by a test in |
| 160 // the destructor and prevent them from being leaked. | 162 // the destructor and prevent them from being leaked. |
| 161 mutable ScopedVector<MockRenderProcessHost> processes_; | 163 mutable ScopedVector<MockRenderProcessHost> processes_; |
| 162 | 164 |
| 163 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); | 165 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); |
| 164 }; | 166 }; |
| 165 | 167 |
| 166 } // namespace content | 168 } // namespace content |
| 167 | 169 |
| 168 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ | 170 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ |
| OLD | NEW |