| OLD | NEW |
| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 virtual void OnExtendableMessageEvent( | 183 virtual void OnExtendableMessageEvent( |
| 184 mojom::ExtendableMessageEventPtr event, | 184 mojom::ExtendableMessageEventPtr event, |
| 185 const mojom::ServiceWorkerEventDispatcher:: | 185 const mojom::ServiceWorkerEventDispatcher:: |
| 186 DispatchExtendableMessageEventCallback& callback); | 186 DispatchExtendableMessageEventCallback& callback); |
| 187 virtual void OnInstallEvent(int embedded_worker_id, int request_id); | 187 virtual void OnInstallEvent(int embedded_worker_id, int request_id); |
| 188 virtual void OnFetchEvent(int embedded_worker_id, | 188 virtual void OnFetchEvent(int embedded_worker_id, |
| 189 int fetch_event_id, | 189 int fetch_event_id, |
| 190 const ServiceWorkerFetchRequest& request, | 190 const ServiceWorkerFetchRequest& request, |
| 191 mojom::FetchEventPreloadHandlePtr preload_handle, | 191 mojom::FetchEventPreloadHandlePtr preload_handle, |
| 192 const FetchCallback& callback); | 192 const FetchCallback& callback); |
| 193 virtual void OnPushEvent(int embedded_worker_id, | 193 virtual void OnPushEvent( |
| 194 int request_id, | 194 const PushEventPayload& payload, |
| 195 const PushEventPayload& payload); | 195 const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback& |
| 196 callback); |
| 196 | 197 |
| 197 // These functions simulate sending an EmbeddedHostMsg message through the | 198 // These functions simulate sending an EmbeddedHostMsg message through the |
| 198 // legacy IPC system to the browser. | 199 // legacy IPC system to the browser. |
| 199 void SimulateWorkerReadyForInspection(int embedded_worker_id); | 200 void SimulateWorkerReadyForInspection(int embedded_worker_id); |
| 200 void SimulateWorkerScriptCached(int embedded_worker_id); | 201 void SimulateWorkerScriptCached(int embedded_worker_id); |
| 201 void SimulateWorkerScriptLoaded(int embedded_worker_id); | 202 void SimulateWorkerScriptLoaded(int embedded_worker_id); |
| 202 void SimulateWorkerThreadStarted(int thread_id, int embedded_worker_id); | 203 void SimulateWorkerThreadStarted(int thread_id, int embedded_worker_id); |
| 203 void SimulateWorkerScriptEvaluated(int embedded_worker_id, bool success); | 204 void SimulateWorkerScriptEvaluated(int embedded_worker_id, bool success); |
| 204 void SimulateWorkerStarted(int embedded_worker_id); | 205 void SimulateWorkerStarted(int embedded_worker_id); |
| 205 void SimulateWorkerStopped(int embedded_worker_id); | 206 void SimulateWorkerStopped(int embedded_worker_id); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 223 void OnExtendableMessageEventStub( | 224 void OnExtendableMessageEventStub( |
| 224 mojom::ExtendableMessageEventPtr event, | 225 mojom::ExtendableMessageEventPtr event, |
| 225 const mojom::ServiceWorkerEventDispatcher:: | 226 const mojom::ServiceWorkerEventDispatcher:: |
| 226 DispatchExtendableMessageEventCallback& callback); | 227 DispatchExtendableMessageEventCallback& callback); |
| 227 void OnInstallEventStub(int request_id); | 228 void OnInstallEventStub(int request_id); |
| 228 void OnFetchEventStub(int thread_id, | 229 void OnFetchEventStub(int thread_id, |
| 229 int fetch_event_id, | 230 int fetch_event_id, |
| 230 const ServiceWorkerFetchRequest& request, | 231 const ServiceWorkerFetchRequest& request, |
| 231 mojom::FetchEventPreloadHandlePtr preload_handle, | 232 mojom::FetchEventPreloadHandlePtr preload_handle, |
| 232 const FetchCallback& callback); | 233 const FetchCallback& callback); |
| 233 void OnPushEventStub(int request_id, const PushEventPayload& payload); | 234 void OnPushEventStub( |
| 235 const PushEventPayload& payload, |
| 236 const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback& |
| 237 callback); |
| 234 | 238 |
| 235 MessagePortMessageFilter* NewMessagePortMessageFilter(); | 239 MessagePortMessageFilter* NewMessagePortMessageFilter(); |
| 236 | 240 |
| 237 std::unique_ptr<service_manager::InterfaceRegistry> CreateInterfaceRegistry( | 241 std::unique_ptr<service_manager::InterfaceRegistry> CreateInterfaceRegistry( |
| 238 MockRenderProcessHost* rph); | 242 MockRenderProcessHost* rph); |
| 239 | 243 |
| 240 std::unique_ptr<TestBrowserContext> browser_context_; | 244 std::unique_ptr<TestBrowserContext> browser_context_; |
| 241 std::unique_ptr<MockRenderProcessHost> render_process_host_; | 245 std::unique_ptr<MockRenderProcessHost> render_process_host_; |
| 242 std::unique_ptr<MockRenderProcessHost> new_render_process_host_; | 246 std::unique_ptr<MockRenderProcessHost> new_render_process_host_; |
| 243 | 247 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 std::unique_ptr<MockType> mock = | 284 std::unique_ptr<MockType> mock = |
| 281 base::MakeUnique<MockType>(std::forward<Args>(args)...); | 285 base::MakeUnique<MockType>(std::forward<Args>(args)...); |
| 282 MockType* mock_rawptr = mock.get(); | 286 MockType* mock_rawptr = mock.get(); |
| 283 RegisterMockInstanceClient(std::move(mock)); | 287 RegisterMockInstanceClient(std::move(mock)); |
| 284 return mock_rawptr; | 288 return mock_rawptr; |
| 285 } | 289 } |
| 286 | 290 |
| 287 } // namespace content | 291 } // namespace content |
| 288 | 292 |
| 289 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ | 293 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ |
| OLD | NEW |