Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: content/public/test/mock_render_process_host.h

Issue 2420843004: Clean up mojom::Renderer usage in RPH (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "base/metrics/persistent_memory_allocator.h" 15 #include "base/metrics/persistent_memory_allocator.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
18 #include "content/public/browser/render_process_host_factory.h" 18 #include "content/public/browser/render_process_host_factory.h"
19 #include "ipc/ipc_test_sink.h" 19 #include "ipc/ipc_test_sink.h"
20 #include "mojo/public/cpp/bindings/associated_interface_ptr.h"
20 #include "services/service_manager/public/cpp/interface_provider.h" 21 #include "services/service_manager/public/cpp/interface_provider.h"
21 22
22 class StoragePartition; 23 class StoragePartition;
23 24
24 namespace content { 25 namespace content {
25 26
26 class MockRenderProcessHostFactory; 27 class MockRenderProcessHostFactory;
27 28
28 // A mock render process host that has no corresponding renderer process. All 29 // A mock render process host that has no corresponding renderer process. All
29 // IPC messages are sent into the message sink for inspection by tests. 30 // IPC messages are sent into the message sink for inspection by tests.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 override; 98 override;
98 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override; 99 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override;
99 bool IsProcessBackgrounded() const override; 100 bool IsProcessBackgrounded() const override;
100 void IncrementServiceWorkerRefCount() override; 101 void IncrementServiceWorkerRefCount() override;
101 void DecrementServiceWorkerRefCount() override; 102 void DecrementServiceWorkerRefCount() override;
102 void IncrementSharedWorkerRefCount() override; 103 void IncrementSharedWorkerRefCount() override;
103 void DecrementSharedWorkerRefCount() override; 104 void DecrementSharedWorkerRefCount() override;
104 void ForceReleaseWorkerRefCounts() override; 105 void ForceReleaseWorkerRefCounts() override;
105 bool IsWorkerRefCountDisabled() override; 106 bool IsWorkerRefCountDisabled() override;
106 void PurgeAndSuspend() override; 107 void PurgeAndSuspend() override;
108 mojom::Renderer* GetRendererInterface() override;
107 109
108 // IPC::Sender via RenderProcessHost. 110 // IPC::Sender via RenderProcessHost.
109 bool Send(IPC::Message* msg) override; 111 bool Send(IPC::Message* msg) override;
110 112
111 // IPC::Listener via RenderProcessHost. 113 // IPC::Listener via RenderProcessHost.
112 bool OnMessageReceived(const IPC::Message& msg) override; 114 bool OnMessageReceived(const IPC::Message& msg) override;
113 void OnChannelConnected(int32_t peer_pid) override; 115 void OnChannelConnected(int32_t peer_pid) override;
114 116
115 // Attaches the factory object so we can remove this object in its destructor 117 // Attaches the factory object so we can remove this object in its destructor
116 // and prevent MockRenderProcessHostFacotry from deleting it. 118 // and prevent MockRenderProcessHostFacotry from deleting it.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 IDMap<RenderWidgetHost> render_widget_hosts_; 155 IDMap<RenderWidgetHost> render_widget_hosts_;
154 int prev_routing_id_; 156 int prev_routing_id_;
155 IDMap<IPC::Listener> listeners_; 157 IDMap<IPC::Listener> listeners_;
156 bool fast_shutdown_started_; 158 bool fast_shutdown_started_;
157 bool deletion_callback_called_; 159 bool deletion_callback_called_;
158 bool is_for_guests_only_; 160 bool is_for_guests_only_;
159 bool is_process_backgrounded_; 161 bool is_process_backgrounded_;
160 std::unique_ptr<base::ProcessHandle> process_handle; 162 std::unique_ptr<base::ProcessHandle> process_handle;
161 int worker_ref_count_; 163 int worker_ref_count_;
162 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_; 164 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_;
165 std::unique_ptr<mojo::AssociatedInterfacePtr<mojom::Renderer>>
166 renderer_interface_;
163 167
164 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); 168 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost);
165 }; 169 };
166 170
167 class MockRenderProcessHostFactory : public RenderProcessHostFactory { 171 class MockRenderProcessHostFactory : public RenderProcessHostFactory {
168 public: 172 public:
169 MockRenderProcessHostFactory(); 173 MockRenderProcessHostFactory();
170 ~MockRenderProcessHostFactory() override; 174 ~MockRenderProcessHostFactory() override;
171 175
172 RenderProcessHost* CreateRenderProcessHost( 176 RenderProcessHost* CreateRenderProcessHost(
(...skipping 10 matching lines...) Expand all
183 // for deleting all MockRenderProcessHosts that have not deleted by a test in 187 // for deleting all MockRenderProcessHosts that have not deleted by a test in
184 // the destructor and prevent them from being leaked. 188 // the destructor and prevent them from being leaked.
185 mutable ScopedVector<MockRenderProcessHost> processes_; 189 mutable ScopedVector<MockRenderProcessHost> processes_;
186 190
187 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); 191 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory);
188 }; 192 };
189 193
190 } // namespace content 194 } // namespace content
191 195
192 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ 196 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « content/public/browser/render_process_host.h ('k') | content/public/test/mock_render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698