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

Side by Side Diff: content/browser/service_worker/embedded_worker_test_helper.h

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Cleanup Created 3 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 19 matching lines...) Expand all
30 class GURL; 30 class GURL;
31 31
32 namespace service_manager { 32 namespace service_manager {
33 class InterfaceRegistry; 33 class InterfaceRegistry;
34 } 34 }
35 35
36 namespace content { 36 namespace content {
37 37
38 class EmbeddedWorkerRegistry; 38 class EmbeddedWorkerRegistry;
39 class EmbeddedWorkerTestHelper; 39 class EmbeddedWorkerTestHelper;
40 class MessagePortMessageFilter;
41 class MockRenderProcessHost; 40 class MockRenderProcessHost;
42 class ServiceWorkerContextCore; 41 class ServiceWorkerContextCore;
43 class ServiceWorkerContextWrapper; 42 class ServiceWorkerContextWrapper;
44 class TestBrowserContext; 43 class TestBrowserContext;
45 struct EmbeddedWorkerStartParams; 44 struct EmbeddedWorkerStartParams;
46 struct PushEventPayload; 45 struct PushEventPayload;
47 struct ServiceWorkerFetchRequest; 46 struct ServiceWorkerFetchRequest;
48 47
49 // In-Process EmbeddedWorker test helper. 48 // In-Process EmbeddedWorker test helper.
50 // 49 //
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 const mojom::ServiceWorkerEventDispatcher:: 224 const mojom::ServiceWorkerEventDispatcher::
226 DispatchExtendableMessageEventCallback& callback); 225 DispatchExtendableMessageEventCallback& callback);
227 void OnInstallEventStub(int request_id); 226 void OnInstallEventStub(int request_id);
228 void OnFetchEventStub(int thread_id, 227 void OnFetchEventStub(int thread_id,
229 int fetch_event_id, 228 int fetch_event_id,
230 const ServiceWorkerFetchRequest& request, 229 const ServiceWorkerFetchRequest& request,
231 mojom::FetchEventPreloadHandlePtr preload_handle, 230 mojom::FetchEventPreloadHandlePtr preload_handle,
232 const FetchCallback& callback); 231 const FetchCallback& callback);
233 void OnPushEventStub(int request_id, const PushEventPayload& payload); 232 void OnPushEventStub(int request_id, const PushEventPayload& payload);
234 233
235 MessagePortMessageFilter* NewMessagePortMessageFilter();
236
237 std::unique_ptr<service_manager::InterfaceRegistry> CreateInterfaceRegistry( 234 std::unique_ptr<service_manager::InterfaceRegistry> CreateInterfaceRegistry(
238 MockRenderProcessHost* rph); 235 MockRenderProcessHost* rph);
239 236
240 std::unique_ptr<TestBrowserContext> browser_context_; 237 std::unique_ptr<TestBrowserContext> browser_context_;
241 std::unique_ptr<MockRenderProcessHost> render_process_host_; 238 std::unique_ptr<MockRenderProcessHost> render_process_host_;
242 std::unique_ptr<MockRenderProcessHost> new_render_process_host_; 239 std::unique_ptr<MockRenderProcessHost> new_render_process_host_;
243 240
244 scoped_refptr<ServiceWorkerContextWrapper> wrapper_; 241 scoped_refptr<ServiceWorkerContextWrapper> wrapper_;
245 242
246 IPC::TestSink sink_; 243 IPC::TestSink sink_;
(...skipping 12 matching lines...) Expand all
259 std::unique_ptr<service_manager::InterfaceRegistry> 256 std::unique_ptr<service_manager::InterfaceRegistry>
260 new_render_process_interface_registry_; 257 new_render_process_interface_registry_;
261 258
262 std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map_; 259 std::map<int, int64_t> embedded_worker_id_service_worker_version_id_map_;
263 std::map<int /* thread_id */, int /* embedded_worker_id */> 260 std::map<int /* thread_id */, int /* embedded_worker_id */>
264 thread_id_embedded_worker_id_map_; 261 thread_id_embedded_worker_id_map_;
265 262
266 // Updated each time MessageToWorker message is received. 263 // Updated each time MessageToWorker message is received.
267 int current_embedded_worker_id_; 264 int current_embedded_worker_id_;
268 265
269 std::vector<scoped_refptr<MessagePortMessageFilter>>
270 message_port_message_filters_;
271
272 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; 266 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_;
273 267
274 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); 268 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper);
275 }; 269 };
276 270
277 template <typename MockType, typename... Args> 271 template <typename MockType, typename... Args>
278 MockType* EmbeddedWorkerTestHelper::CreateAndRegisterMockInstanceClient( 272 MockType* EmbeddedWorkerTestHelper::CreateAndRegisterMockInstanceClient(
279 Args&&... args) { 273 Args&&... args) {
280 std::unique_ptr<MockType> mock = 274 std::unique_ptr<MockType> mock =
281 base::MakeUnique<MockType>(std::forward<Args>(args)...); 275 base::MakeUnique<MockType>(std::forward<Args>(args)...);
282 MockType* mock_rawptr = mock.get(); 276 MockType* mock_rawptr = mock.get();
283 RegisterMockInstanceClient(std::move(mock)); 277 RegisterMockInstanceClient(std::move(mock));
284 return mock_rawptr; 278 return mock_rawptr;
285 } 279 }
286 280
287 } // namespace content 281 } // namespace content
288 282
289 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ 283 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698