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

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

Issue 2096643002: Eliminate MojoApplicationHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mah3
Patch Set: . Created 4 years, 6 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 <utility> 10 #include <utility>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "base/metrics/persistent_memory_allocator.h" 14 #include "base/metrics/persistent_memory_allocator.h"
15 #include "base/observer_list.h" 15 #include "base/observer_list.h"
16 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
17 #include "content/public/browser/render_process_host_factory.h" 17 #include "content/public/browser/render_process_host_factory.h"
18 #include "content/public/common/service_registry.h" 18 #include "content/public/common/service_registry.h"
19 #include "ipc/ipc_test_sink.h" 19 #include "ipc/ipc_test_sink.h"
20 #include "services/shell/public/cpp/interface_provider.h"
21 #include "services/shell/public/cpp/interface_registry.h"
20 22
21 class StoragePartition; 23 class StoragePartition;
22 24
23 namespace content { 25 namespace content {
24 26
25 class MockRenderProcessHostFactory; 27 class MockRenderProcessHostFactory;
26 28
27 // 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
28 // 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.
29 class MockRenderProcessHost : public RenderProcessHost { 31 class MockRenderProcessHost : public RenderProcessHost {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 void SetWebRtcLogMessageCallback( 88 void SetWebRtcLogMessageCallback(
87 base::Callback<void(const std::string&)> callback) override; 89 base::Callback<void(const std::string&)> callback) override;
88 void ClearWebRtcLogMessageCallback() override; 90 void ClearWebRtcLogMessageCallback() override;
89 WebRtcStopRtpDumpCallback StartRtpDump( 91 WebRtcStopRtpDumpCallback StartRtpDump(
90 bool incoming, 92 bool incoming,
91 bool outgoing, 93 bool outgoing,
92 const WebRtcRtpPacketCallback& packet_callback) override; 94 const WebRtcRtpPacketCallback& packet_callback) override;
93 #endif 95 #endif
94 void ResumeDeferredNavigation(const GlobalRequestID& request_id) override; 96 void ResumeDeferredNavigation(const GlobalRequestID& request_id) override;
95 void NotifyTimezoneChange(const std::string& zone_id) override; 97 void NotifyTimezoneChange(const std::string& zone_id) override;
96 ServiceRegistry* GetServiceRegistry() override; 98 shell::InterfaceRegistry* GetInterfaceRegistry() override;
99 shell::InterfaceProvider* GetRemoteInterfaces() override;
97 shell::Connection* GetChildConnection() override; 100 shell::Connection* GetChildConnection() override;
98 std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator() 101 std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator()
99 override; 102 override;
100 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override; 103 const base::TimeTicks& GetInitTimeForNavigationMetrics() const override;
101 #if defined(ENABLE_BROWSER_CDMS) 104 #if defined(ENABLE_BROWSER_CDMS)
102 scoped_refptr<media::MediaKeys> GetCdm(int render_frame_id, 105 scoped_refptr<media::MediaKeys> GetCdm(int render_frame_id,
103 int cdm_id) const override; 106 int cdm_id) const override;
104 #endif 107 #endif
105 bool IsProcessBackgrounded() const override; 108 bool IsProcessBackgrounded() const override;
106 void IncrementWorkerRefCount() override; 109 void IncrementWorkerRefCount() override;
(...skipping 23 matching lines...) Expand all
130 133
131 void SetProcessHandle(std::unique_ptr<base::ProcessHandle> new_handle) { 134 void SetProcessHandle(std::unique_ptr<base::ProcessHandle> new_handle) {
132 process_handle = std::move(new_handle); 135 process_handle = std::move(new_handle);
133 } 136 }
134 137
135 void GetAudioOutputControllers( 138 void GetAudioOutputControllers(
136 const GetAudioOutputControllersCallback& callback) const override {} 139 const GetAudioOutputControllersCallback& callback) const override {}
137 140
138 int worker_ref_count() const { return worker_ref_count_; } 141 int worker_ref_count() const { return worker_ref_count_; }
139 142
140 void SetServiceRegistry(std::unique_ptr<ServiceRegistry> service_registry) { 143 void SetInterfaceRegistry(
141 service_registry_ = std::move(service_registry); 144 std::unique_ptr<shell::InterfaceRegistry> interface_registry) {
145 interface_registry_ = std::move(interface_registry);
146 }
147 void SetRemoteInterfaces(
148 std::unique_ptr<shell::InterfaceProvider> remote_interfaces) {
149 remote_interfaces_ = std::move(remote_interfaces);
142 } 150 }
143 151
144 private: 152 private:
145 // Stores IPC messages that would have been sent to the renderer. 153 // Stores IPC messages that would have been sent to the renderer.
146 IPC::TestSink sink_; 154 IPC::TestSink sink_;
147 int bad_msg_count_; 155 int bad_msg_count_;
148 const MockRenderProcessHostFactory* factory_; 156 const MockRenderProcessHostFactory* factory_;
149 int id_; 157 int id_;
150 bool has_connection_; 158 bool has_connection_;
151 BrowserContext* browser_context_; 159 BrowserContext* browser_context_;
152 base::ObserverList<RenderProcessHostObserver> observers_; 160 base::ObserverList<RenderProcessHostObserver> observers_;
153 161
154 IDMap<RenderWidgetHost> render_widget_hosts_; 162 IDMap<RenderWidgetHost> render_widget_hosts_;
155 int prev_routing_id_; 163 int prev_routing_id_;
156 IDMap<IPC::Listener> listeners_; 164 IDMap<IPC::Listener> listeners_;
157 bool fast_shutdown_started_; 165 bool fast_shutdown_started_;
158 bool deletion_callback_called_; 166 bool deletion_callback_called_;
159 bool is_for_guests_only_; 167 bool is_for_guests_only_;
160 bool is_process_backgrounded_; 168 bool is_process_backgrounded_;
161 std::unique_ptr<base::ProcessHandle> process_handle; 169 std::unique_ptr<base::ProcessHandle> process_handle;
162 int worker_ref_count_; 170 int worker_ref_count_;
163 std::unique_ptr<ServiceRegistry> service_registry_; 171 std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
172 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
164 173
165 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost); 174 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHost);
166 }; 175 };
167 176
168 class MockRenderProcessHostFactory : public RenderProcessHostFactory { 177 class MockRenderProcessHostFactory : public RenderProcessHostFactory {
169 public: 178 public:
170 MockRenderProcessHostFactory(); 179 MockRenderProcessHostFactory();
171 ~MockRenderProcessHostFactory() override; 180 ~MockRenderProcessHostFactory() override;
172 181
173 RenderProcessHost* CreateRenderProcessHost( 182 RenderProcessHost* CreateRenderProcessHost(
(...skipping 10 matching lines...) Expand all
184 // for deleting all MockRenderProcessHosts that have not deleted by a test in 193 // for deleting all MockRenderProcessHosts that have not deleted by a test in
185 // the destructor and prevent them from being leaked. 194 // the destructor and prevent them from being leaked.
186 mutable ScopedVector<MockRenderProcessHost> processes_; 195 mutable ScopedVector<MockRenderProcessHost> processes_;
187 196
188 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory); 197 DISALLOW_COPY_AND_ASSIGN(MockRenderProcessHostFactory);
189 }; 198 };
190 199
191 } // namespace content 200 } // namespace content
192 201
193 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_ 202 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « content/public/renderer/render_thread.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