| 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 25 matching lines...) Expand all Loading... |
| 36 namespace content { | 36 namespace content { |
| 37 | 37 |
| 38 class EmbeddedWorkerRegistry; | 38 class EmbeddedWorkerRegistry; |
| 39 class EmbeddedWorkerTestHelper; | 39 class EmbeddedWorkerTestHelper; |
| 40 class MessagePortMessageFilter; | 40 class MessagePortMessageFilter; |
| 41 class MockRenderProcessHost; | 41 class MockRenderProcessHost; |
| 42 class ServiceWorkerContextCore; | 42 class ServiceWorkerContextCore; |
| 43 class ServiceWorkerContextWrapper; | 43 class ServiceWorkerContextWrapper; |
| 44 class TestBrowserContext; | 44 class TestBrowserContext; |
| 45 struct EmbeddedWorkerStartParams; | 45 struct EmbeddedWorkerStartParams; |
| 46 struct PlatformNotificationData; |
| 46 struct PushEventPayload; | 47 struct PushEventPayload; |
| 47 struct ServiceWorkerFetchRequest; | 48 struct ServiceWorkerFetchRequest; |
| 48 | 49 |
| 49 // In-Process EmbeddedWorker test helper. | 50 // In-Process EmbeddedWorker test helper. |
| 50 // | 51 // |
| 51 // Usage: create an instance of this class to test browser-side embedded worker | 52 // Usage: create an instance of this class to test browser-side embedded worker |
| 52 // code without creating a child process. This class will create a | 53 // code without creating a child process. This class will create a |
| 53 // ServiceWorkerContextWrapper and ServiceWorkerContextCore for you. | 54 // ServiceWorkerContextWrapper and ServiceWorkerContextCore for you. |
| 54 // | 55 // |
| 55 // By default this class just notifies back WorkerStarted and WorkerStopped | 56 // By default this class just notifies back WorkerStarted and WorkerStopped |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 virtual void OnExtendableMessageEvent( | 187 virtual void OnExtendableMessageEvent( |
| 187 mojom::ExtendableMessageEventPtr event, | 188 mojom::ExtendableMessageEventPtr event, |
| 188 const mojom::ServiceWorkerEventDispatcher:: | 189 const mojom::ServiceWorkerEventDispatcher:: |
| 189 DispatchExtendableMessageEventCallback& callback); | 190 DispatchExtendableMessageEventCallback& callback); |
| 190 virtual void OnInstallEvent(int embedded_worker_id, int request_id); | 191 virtual void OnInstallEvent(int embedded_worker_id, int request_id); |
| 191 virtual void OnFetchEvent(int embedded_worker_id, | 192 virtual void OnFetchEvent(int embedded_worker_id, |
| 192 int fetch_event_id, | 193 int fetch_event_id, |
| 193 const ServiceWorkerFetchRequest& request, | 194 const ServiceWorkerFetchRequest& request, |
| 194 mojom::FetchEventPreloadHandlePtr preload_handle, | 195 mojom::FetchEventPreloadHandlePtr preload_handle, |
| 195 const FetchCallback& callback); | 196 const FetchCallback& callback); |
| 197 virtual void OnNotificationClickEvent( |
| 198 const std::string& notification_id, |
| 199 const PlatformNotificationData& notification_data, |
| 200 int action_index, |
| 201 const base::Optional<base::string16>& reply, |
| 202 const mojom::ServiceWorkerEventDispatcher:: |
| 203 DispatchNotificationClickEventCallback& callback); |
| 204 virtual void OnNotificationCloseEvent( |
| 205 const std::string& notification_id, |
| 206 const PlatformNotificationData& notification_data, |
| 207 const mojom::ServiceWorkerEventDispatcher:: |
| 208 DispatchNotificationCloseEventCallback& callback); |
| 196 virtual void OnPushEvent( | 209 virtual void OnPushEvent( |
| 197 const PushEventPayload& payload, | 210 const PushEventPayload& payload, |
| 198 const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback& | 211 const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback& |
| 199 callback); | 212 callback); |
| 200 virtual void OnPaymentRequestEvent( | 213 virtual void OnPaymentRequestEvent( |
| 201 payments::mojom::PaymentAppRequestPtr data, | 214 payments::mojom::PaymentAppRequestPtr data, |
| 202 const mojom::ServiceWorkerEventDispatcher:: | 215 const mojom::ServiceWorkerEventDispatcher:: |
| 203 DispatchPaymentRequestEventCallback& callback); | 216 DispatchPaymentRequestEventCallback& callback); |
| 204 | 217 |
| 205 // These functions simulate sending an EmbeddedHostMsg message through the | 218 // These functions simulate sending an EmbeddedHostMsg message through the |
| (...skipping 24 matching lines...) Expand all Loading... |
| 230 void OnExtendableMessageEventStub( | 243 void OnExtendableMessageEventStub( |
| 231 mojom::ExtendableMessageEventPtr event, | 244 mojom::ExtendableMessageEventPtr event, |
| 232 const mojom::ServiceWorkerEventDispatcher:: | 245 const mojom::ServiceWorkerEventDispatcher:: |
| 233 DispatchExtendableMessageEventCallback& callback); | 246 DispatchExtendableMessageEventCallback& callback); |
| 234 void OnInstallEventStub(int request_id); | 247 void OnInstallEventStub(int request_id); |
| 235 void OnFetchEventStub(int thread_id, | 248 void OnFetchEventStub(int thread_id, |
| 236 int fetch_event_id, | 249 int fetch_event_id, |
| 237 const ServiceWorkerFetchRequest& request, | 250 const ServiceWorkerFetchRequest& request, |
| 238 mojom::FetchEventPreloadHandlePtr preload_handle, | 251 mojom::FetchEventPreloadHandlePtr preload_handle, |
| 239 const FetchCallback& callback); | 252 const FetchCallback& callback); |
| 253 void OnNotificationClickEventStub( |
| 254 const std::string& notification_id, |
| 255 const PlatformNotificationData& notification_data, |
| 256 int action_index, |
| 257 const base::Optional<base::string16>& reply, |
| 258 const mojom::ServiceWorkerEventDispatcher:: |
| 259 DispatchNotificationClickEventCallback& callback); |
| 260 void OnNotificationCloseEventStub( |
| 261 const std::string& notification_id, |
| 262 const PlatformNotificationData& notification_data, |
| 263 const mojom::ServiceWorkerEventDispatcher:: |
| 264 DispatchNotificationCloseEventCallback& callback); |
| 240 void OnPushEventStub( | 265 void OnPushEventStub( |
| 241 const PushEventPayload& payload, | 266 const PushEventPayload& payload, |
| 242 const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback& | 267 const mojom::ServiceWorkerEventDispatcher::DispatchPushEventCallback& |
| 243 callback); | 268 callback); |
| 244 void OnPaymentRequestEventStub( | 269 void OnPaymentRequestEventStub( |
| 245 payments::mojom::PaymentAppRequestPtr data, | 270 payments::mojom::PaymentAppRequestPtr data, |
| 246 const mojom::ServiceWorkerEventDispatcher:: | 271 const mojom::ServiceWorkerEventDispatcher:: |
| 247 DispatchPaymentRequestEventCallback& callback); | 272 DispatchPaymentRequestEventCallback& callback); |
| 248 | 273 |
| 249 MessagePortMessageFilter* NewMessagePortMessageFilter(); | 274 MessagePortMessageFilter* NewMessagePortMessageFilter(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 std::unique_ptr<MockType> mock = | 319 std::unique_ptr<MockType> mock = |
| 295 base::MakeUnique<MockType>(std::forward<Args>(args)...); | 320 base::MakeUnique<MockType>(std::forward<Args>(args)...); |
| 296 MockType* mock_rawptr = mock.get(); | 321 MockType* mock_rawptr = mock.get(); |
| 297 RegisterMockInstanceClient(std::move(mock)); | 322 RegisterMockInstanceClient(std::move(mock)); |
| 298 return mock_rawptr; | 323 return mock_rawptr; |
| 299 } | 324 } |
| 300 | 325 |
| 301 } // namespace content | 326 } // namespace content |
| 302 | 327 |
| 303 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ | 328 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ |
| OLD | NEW |