Chromium Code Reviews| Index: content/browser/service_worker/embedded_worker_test_helper.h |
| diff --git a/content/browser/service_worker/embedded_worker_test_helper.h b/content/browser/service_worker/embedded_worker_test_helper.h |
| index 108327d1f66b3f185b198b5921e54e7cf8d12e97..17eee4dec9e0d8b85ae902172ea83450792afbd3 100644 |
| --- a/content/browser/service_worker/embedded_worker_test_helper.h |
| +++ b/content/browser/service_worker/embedded_worker_test_helper.h |
| @@ -154,29 +154,25 @@ class EmbeddedWorkerTestHelper : public IPC::Sender, |
| static net::HttpResponseInfo CreateHttpResponseInfo(); |
| protected: |
| - // Called when StartWorker, StopWorker and SendMessageToWorker message |
| - // is sent to the embedded worker. Override if necessary. By default |
| - // they verify given parameters and: |
| - // - OnStartWorker calls SimulateWorkerStarted |
| - // - OnStopWorker calls SimulateWorkerStoped |
| - // - OnSendMessageToWorker calls the message's respective On*Event handler |
| - virtual void OnStartWorker(int embedded_worker_id, |
| - int64_t service_worker_version_id, |
| - const GURL& scope, |
| - const GURL& script_url, |
| - bool pause_after_download); |
| + // StartWorker IPC handler. This simulates each IPC sent from the renderer and |
| + // binds |request| to MockServiceWorkerEventDispatcher by default. |
| + virtual void OnStartWorker( |
| + int embedded_worker_id, |
| + int64_t service_worker_version_id, |
| + const GURL& scope, |
| + const GURL& script_url, |
| + bool pause_after_download, |
| + mojom::ServiceWorkerEventDispatcherRequest request); |
| virtual void OnResumeAfterDownload(int embedded_worker_id); |
| - virtual void OnStopWorker(int embedded_worker_id); |
| + // StopWorker IPC handler. This calls StopWorkerCallback by default. |
|
falken
2017/01/12 02:29:05
The Mojo and IPC mixing is a bit confusing. Can th
shimazu
2017/01/12 03:48:27
I think it might be a bit confusing, too...
Curre
falken
2017/01/12 04:14:47
I find it confusing because I think people often t
shimazu
2017/01/12 05:25:20
Thanks for clear explanation.
There are several d
|
| + virtual void OnStopWorker( |
| + const mojom::EmbeddedWorkerInstanceClient::StopWorkerCallback& callback); |
| + // The legacy IPC mesasge handler. This passes the messages to their |
| + // respective On*Event handler by default. |
|
falken
2017/01/12 02:29:05
Why is this called "legacy IPC" and the ones above
shimazu
2017/01/12 03:48:27
OnMessageToWorker handles only the legacy IPC's me
falken
2017/01/12 04:14:47
OK... Let's fix s/mesasge/message.
shimazu
2017/01/12 05:25:20
Done.
|
| virtual bool OnMessageToWorker(int thread_id, |
| int embedded_worker_id, |
| const IPC::Message& message); |
| - // Called to setup mojo for a new embedded worker. Override to register |
| - // interfaces the worker should expose to the browser. |
| - virtual void OnSetupMojo( |
| - int thread_id, |
| - mojom::ServiceWorkerEventDispatcherRequest dispatcher_request); |
| - |
| // On*Event handlers. Called by the default implementation of |
| // OnMessageToWorker when events are sent to the embedded |
| // worker. By default they just return success via |
| @@ -196,8 +192,8 @@ class EmbeddedWorkerTestHelper : public IPC::Sender, |
| int request_id, |
| const PushEventPayload& payload); |
| - // These functions simulate sending an EmbeddedHostMsg message to the |
| - // browser. |
| + // These functions simulate sending an EmbeddedHostMsg message through the |
| + // legacy IPC system to the browser. |
| void SimulateWorkerReadyForInspection(int embedded_worker_id); |
| void SimulateWorkerScriptCached(int embedded_worker_id); |
| void SimulateWorkerScriptLoaded(int embedded_worker_id); |
| @@ -213,9 +209,11 @@ class EmbeddedWorkerTestHelper : public IPC::Sender, |
| class MockEmbeddedWorkerSetup; |
| class MockServiceWorkerEventDispatcher; |
| - void OnStartWorkerStub(const EmbeddedWorkerStartParams& params); |
| + void OnStartWorkerStub(const EmbeddedWorkerStartParams& params, |
| + mojom::ServiceWorkerEventDispatcherRequest request); |
| void OnResumeAfterDownloadStub(int embedded_worker_id); |
| - void OnStopWorkerStub(int embedded_worker_id); |
| + void OnStopWorkerStub( |
| + const mojom::EmbeddedWorkerInstanceClient::StopWorkerCallback& callback); |
| void OnMessageToWorkerStub(int thread_id, |
| int embedded_worker_id, |
| const IPC::Message& message); |