| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 int embedded_worker_id, | 182 int embedded_worker_id, |
| 183 const IPC::Message& message); | 183 const IPC::Message& message); |
| 184 | 184 |
| 185 // On*Event handlers. Called by the default implementation of | 185 // On*Event handlers. Called by the default implementation of |
| 186 // OnMessageToWorker when events are sent to the embedded | 186 // OnMessageToWorker when events are sent to the embedded |
| 187 // worker. By default they just return success via | 187 // worker. By default they just return success via |
| 188 // SimulateSendReplyToBrowser. | 188 // SimulateSendReplyToBrowser. |
| 189 virtual void OnActivateEvent( | 189 virtual void OnActivateEvent( |
| 190 const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback& | 190 const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback& |
| 191 callback); | 191 callback); |
| 192 virtual void OnBackgroundFetchAbortEvent( |
| 193 const std::string& tag, |
| 194 const mojom::ServiceWorkerEventDispatcher:: |
| 195 DispatchBackgroundFetchAbortEventCallback& callback); |
| 196 virtual void OnBackgroundFetchClickEvent( |
| 197 const std::string& tag, |
| 198 mojom::BackgroundFetchState state, |
| 199 const mojom::ServiceWorkerEventDispatcher:: |
| 200 DispatchBackgroundFetchClickEventCallback& callback); |
| 192 virtual void OnExtendableMessageEvent( | 201 virtual void OnExtendableMessageEvent( |
| 193 mojom::ExtendableMessageEventPtr event, | 202 mojom::ExtendableMessageEventPtr event, |
| 194 const mojom::ServiceWorkerEventDispatcher:: | 203 const mojom::ServiceWorkerEventDispatcher:: |
| 195 DispatchExtendableMessageEventCallback& callback); | 204 DispatchExtendableMessageEventCallback& callback); |
| 196 virtual void OnInstallEvent(int embedded_worker_id, int request_id); | 205 virtual void OnInstallEvent(int embedded_worker_id, int request_id); |
| 197 virtual void OnFetchEvent(int embedded_worker_id, | 206 virtual void OnFetchEvent(int embedded_worker_id, |
| 198 int fetch_event_id, | 207 int fetch_event_id, |
| 199 const ServiceWorkerFetchRequest& request, | 208 const ServiceWorkerFetchRequest& request, |
| 200 mojom::FetchEventPreloadHandlePtr preload_handle, | 209 mojom::FetchEventPreloadHandlePtr preload_handle, |
| 201 const FetchCallback& callback); | 210 const FetchCallback& callback); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 mojom::ServiceWorkerEventDispatcherRequest request); | 249 mojom::ServiceWorkerEventDispatcherRequest request); |
| 241 void OnResumeAfterDownloadStub(int embedded_worker_id); | 250 void OnResumeAfterDownloadStub(int embedded_worker_id); |
| 242 void OnStopWorkerStub( | 251 void OnStopWorkerStub( |
| 243 const mojom::EmbeddedWorkerInstanceClient::StopWorkerCallback& callback); | 252 const mojom::EmbeddedWorkerInstanceClient::StopWorkerCallback& callback); |
| 244 void OnMessageToWorkerStub(int thread_id, | 253 void OnMessageToWorkerStub(int thread_id, |
| 245 int embedded_worker_id, | 254 int embedded_worker_id, |
| 246 const IPC::Message& message); | 255 const IPC::Message& message); |
| 247 void OnActivateEventStub( | 256 void OnActivateEventStub( |
| 248 const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback& | 257 const mojom::ServiceWorkerEventDispatcher::DispatchActivateEventCallback& |
| 249 callback); | 258 callback); |
| 259 void OnBackgroundFetchAbortEventStub( |
| 260 const std::string& tag, |
| 261 const mojom::ServiceWorkerEventDispatcher:: |
| 262 DispatchBackgroundFetchAbortEventCallback& callback); |
| 263 void OnBackgroundFetchClickEventStub( |
| 264 const std::string& tag, |
| 265 mojom::BackgroundFetchState state, |
| 266 const mojom::ServiceWorkerEventDispatcher:: |
| 267 DispatchBackgroundFetchClickEventCallback& callback); |
| 250 void OnExtendableMessageEventStub( | 268 void OnExtendableMessageEventStub( |
| 251 mojom::ExtendableMessageEventPtr event, | 269 mojom::ExtendableMessageEventPtr event, |
| 252 const mojom::ServiceWorkerEventDispatcher:: | 270 const mojom::ServiceWorkerEventDispatcher:: |
| 253 DispatchExtendableMessageEventCallback& callback); | 271 DispatchExtendableMessageEventCallback& callback); |
| 254 void OnInstallEventStub(int request_id); | 272 void OnInstallEventStub(int request_id); |
| 255 void OnFetchEventStub(int thread_id, | 273 void OnFetchEventStub(int thread_id, |
| 256 int fetch_event_id, | 274 int fetch_event_id, |
| 257 const ServiceWorkerFetchRequest& request, | 275 const ServiceWorkerFetchRequest& request, |
| 258 mojom::FetchEventPreloadHandlePtr preload_handle, | 276 mojom::FetchEventPreloadHandlePtr preload_handle, |
| 259 const FetchCallback& callback); | 277 const FetchCallback& callback); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 std::unique_ptr<MockType> mock = | 344 std::unique_ptr<MockType> mock = |
| 327 base::MakeUnique<MockType>(std::forward<Args>(args)...); | 345 base::MakeUnique<MockType>(std::forward<Args>(args)...); |
| 328 MockType* mock_rawptr = mock.get(); | 346 MockType* mock_rawptr = mock.get(); |
| 329 RegisterMockInstanceClient(std::move(mock)); | 347 RegisterMockInstanceClient(std::move(mock)); |
| 330 return mock_rawptr; | 348 return mock_rawptr; |
| 331 } | 349 } |
| 332 | 350 |
| 333 } // namespace content | 351 } // namespace content |
| 334 | 352 |
| 335 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ | 353 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ |
| OLD | NEW |