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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 protected: | 98 protected: |
99 // Called when StartWorker, StopWorker and SendMessageToWorker message | 99 // Called when StartWorker, StopWorker and SendMessageToWorker message |
100 // is sent to the embedded worker. Override if necessary. By default | 100 // is sent to the embedded worker. Override if necessary. By default |
101 // they verify given parameters and: | 101 // they verify given parameters and: |
102 // - OnStartWorker calls SimulateWorkerStarted | 102 // - OnStartWorker calls SimulateWorkerStarted |
103 // - OnStopWorker calls SimulateWorkerStoped | 103 // - OnStopWorker calls SimulateWorkerStoped |
104 // - OnSendMessageToWorker calls the message's respective On*Event handler | 104 // - OnSendMessageToWorker calls the message's respective On*Event handler |
105 virtual void OnStartWorker(int embedded_worker_id, | 105 virtual void OnStartWorker(int embedded_worker_id, |
106 int64_t service_worker_version_id, | 106 int64_t service_worker_version_id, |
107 const GURL& scope, | 107 const GURL& scope, |
108 const GURL& script_url); | 108 const GURL& script_url, |
| 109 bool pause_after_download); |
| 110 virtual void OnResumeAfterDownload(int embedded_worker_id); |
109 virtual void OnStopWorker(int embedded_worker_id); | 111 virtual void OnStopWorker(int embedded_worker_id); |
110 virtual bool OnMessageToWorker(int thread_id, | 112 virtual bool OnMessageToWorker(int thread_id, |
111 int embedded_worker_id, | 113 int embedded_worker_id, |
112 const IPC::Message& message); | 114 const IPC::Message& message); |
113 | 115 |
114 // Called to setup mojo for a new embedded worker. Override to register | 116 // Called to setup mojo for a new embedded worker. Override to register |
115 // services the worker should expose to the browser. | 117 // services the worker should expose to the browser. |
116 virtual void OnSetupMojo(ServiceRegistry* service_registry); | 118 virtual void OnSetupMojo(ServiceRegistry* service_registry); |
117 | 119 |
118 // On*Event handlers. Called by the default implementation of | 120 // On*Event handlers. Called by the default implementation of |
(...skipping 19 matching lines...) Expand all Loading... |
138 void SimulateWorkerStarted(int embedded_worker_id); | 140 void SimulateWorkerStarted(int embedded_worker_id); |
139 void SimulateWorkerStopped(int embedded_worker_id); | 141 void SimulateWorkerStopped(int embedded_worker_id); |
140 void SimulateSend(IPC::Message* message); | 142 void SimulateSend(IPC::Message* message); |
141 | 143 |
142 EmbeddedWorkerRegistry* registry(); | 144 EmbeddedWorkerRegistry* registry(); |
143 | 145 |
144 private: | 146 private: |
145 class MockEmbeddedWorkerSetup; | 147 class MockEmbeddedWorkerSetup; |
146 | 148 |
147 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params); | 149 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params); |
| 150 void OnResumeAfterDownloadStub(int embedded_worker_id); |
148 void OnStopWorkerStub(int embedded_worker_id); | 151 void OnStopWorkerStub(int embedded_worker_id); |
149 void OnMessageToWorkerStub(int thread_id, | 152 void OnMessageToWorkerStub(int thread_id, |
150 int embedded_worker_id, | 153 int embedded_worker_id, |
151 const IPC::Message& message); | 154 const IPC::Message& message); |
152 void OnActivateEventStub(int request_id); | 155 void OnActivateEventStub(int request_id); |
153 void OnInstallEventStub(int request_id); | 156 void OnInstallEventStub(int request_id); |
154 void OnFetchEventStub(int request_id, | 157 void OnFetchEventStub(int request_id, |
155 const ServiceWorkerFetchRequest& request); | 158 const ServiceWorkerFetchRequest& request); |
156 void OnPushEventStub(int request_id, const PushEventPayload& payload); | 159 void OnPushEventStub(int request_id, const PushEventPayload& payload); |
157 void OnSetupMojoStub( | 160 void OnSetupMojoStub( |
(...skipping 30 matching lines...) Expand all Loading... |
188 message_port_message_filters_; | 191 message_port_message_filters_; |
189 | 192 |
190 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; | 193 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; |
191 | 194 |
192 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); | 195 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); |
193 }; | 196 }; |
194 | 197 |
195 } // namespace content | 198 } // namespace content |
196 | 199 |
197 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ | 200 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ |
OLD | NEW |