Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: content/browser/service_worker/embedded_worker_test_helper.h

Issue 1636483002: Update the PushEvent to have a nullable PushMessageData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and integrate OWNERS code review comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 23
24 struct EmbeddedWorkerMsg_StartWorker_Params; 24 struct EmbeddedWorkerMsg_StartWorker_Params;
25 class GURL; 25 class GURL;
26 26
27 namespace content { 27 namespace content {
28 28
29 class EmbeddedWorkerRegistry; 29 class EmbeddedWorkerRegistry;
30 class EmbeddedWorkerTestHelper; 30 class EmbeddedWorkerTestHelper;
31 class MessagePortMessageFilter; 31 class MessagePortMessageFilter;
32 class MockRenderProcessHost; 32 class MockRenderProcessHost;
33 struct PushEventPayload;
33 class ServiceWorkerContextCore; 34 class ServiceWorkerContextCore;
34 class ServiceWorkerContextWrapper; 35 class ServiceWorkerContextWrapper;
35 struct ServiceWorkerFetchRequest; 36 struct ServiceWorkerFetchRequest;
36 class TestBrowserContext; 37 class TestBrowserContext;
37 38
38 // In-Process EmbeddedWorker test helper. 39 // In-Process EmbeddedWorker test helper.
39 // 40 //
40 // Usage: create an instance of this class to test browser-side embedded worker 41 // Usage: create an instance of this class to test browser-side embedded worker
41 // code without creating a child process. This class will create a 42 // code without creating a child process. This class will create a
42 // ServiceWorkerContextWrapper and ServiceWorkerContextCore for you. 43 // ServiceWorkerContextWrapper and ServiceWorkerContextCore for you.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // OnMessageToWorker when events are sent to the embedded 119 // OnMessageToWorker when events are sent to the embedded
119 // worker. By default they just return success via 120 // worker. By default they just return success via
120 // SimulateSendReplyToBrowser. 121 // SimulateSendReplyToBrowser.
121 virtual void OnActivateEvent(int embedded_worker_id, int request_id); 122 virtual void OnActivateEvent(int embedded_worker_id, int request_id);
122 virtual void OnInstallEvent(int embedded_worker_id, int request_id); 123 virtual void OnInstallEvent(int embedded_worker_id, int request_id);
123 virtual void OnFetchEvent(int embedded_worker_id, 124 virtual void OnFetchEvent(int embedded_worker_id,
124 int request_id, 125 int request_id,
125 const ServiceWorkerFetchRequest& request); 126 const ServiceWorkerFetchRequest& request);
126 virtual void OnPushEvent(int embedded_worker_id, 127 virtual void OnPushEvent(int embedded_worker_id,
127 int request_id, 128 int request_id,
128 const std::string& data); 129 const PushEventPayload& data);
Peter Beverloo 2016/01/27 12:33:54 dito
harkness 2016/01/27 17:49:07 Done.
129 130
130 // These functions simulate sending an EmbeddedHostMsg message to the 131 // These functions simulate sending an EmbeddedHostMsg message to the
131 // browser. 132 // browser.
132 void SimulateWorkerReadyForInspection(int embedded_worker_id); 133 void SimulateWorkerReadyForInspection(int embedded_worker_id);
133 void SimulateWorkerScriptCached(int embedded_worker_id); 134 void SimulateWorkerScriptCached(int embedded_worker_id);
134 void SimulateWorkerScriptLoaded(int embedded_worker_id); 135 void SimulateWorkerScriptLoaded(int embedded_worker_id);
135 void SimulateWorkerThreadStarted(int thread_id, int embedded_worker_id); 136 void SimulateWorkerThreadStarted(int thread_id, int embedded_worker_id);
136 void SimulateWorkerScriptEvaluated(int embedded_worker_id, bool success); 137 void SimulateWorkerScriptEvaluated(int embedded_worker_id, bool success);
137 void SimulateWorkerStarted(int embedded_worker_id); 138 void SimulateWorkerStarted(int embedded_worker_id);
138 void SimulateWorkerStopped(int embedded_worker_id); 139 void SimulateWorkerStopped(int embedded_worker_id);
139 void SimulateSend(IPC::Message* message); 140 void SimulateSend(IPC::Message* message);
140 141
141 EmbeddedWorkerRegistry* registry(); 142 EmbeddedWorkerRegistry* registry();
142 143
143 private: 144 private:
144 class MockEmbeddedWorkerSetup; 145 class MockEmbeddedWorkerSetup;
145 146
146 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params); 147 void OnStartWorkerStub(const EmbeddedWorkerMsg_StartWorker_Params& params);
147 void OnStopWorkerStub(int embedded_worker_id); 148 void OnStopWorkerStub(int embedded_worker_id);
148 void OnMessageToWorkerStub(int thread_id, 149 void OnMessageToWorkerStub(int thread_id,
149 int embedded_worker_id, 150 int embedded_worker_id,
150 const IPC::Message& message); 151 const IPC::Message& message);
151 void OnActivateEventStub(int request_id); 152 void OnActivateEventStub(int request_id);
152 void OnInstallEventStub(int request_id); 153 void OnInstallEventStub(int request_id);
153 void OnFetchEventStub(int request_id, 154 void OnFetchEventStub(int request_id,
154 const ServiceWorkerFetchRequest& request); 155 const ServiceWorkerFetchRequest& request);
155 void OnPushEventStub(int request_id, const std::string& data); 156 void OnPushEventStub(int request_id, const PushEventPayload& payload);
156 void OnSetupMojoStub(int thread_id, 157 void OnSetupMojoStub(int thread_id,
157 mojo::InterfaceRequest<mojo::ServiceProvider> services, 158 mojo::InterfaceRequest<mojo::ServiceProvider> services,
158 mojo::ServiceProviderPtr exposed_services); 159 mojo::ServiceProviderPtr exposed_services);
159 160
160 MessagePortMessageFilter* NewMessagePortMessageFilter(); 161 MessagePortMessageFilter* NewMessagePortMessageFilter();
161 162
162 scoped_ptr<TestBrowserContext> browser_context_; 163 scoped_ptr<TestBrowserContext> browser_context_;
163 scoped_ptr<MockRenderProcessHost> render_process_host_; 164 scoped_ptr<MockRenderProcessHost> render_process_host_;
164 165
165 scoped_refptr<ServiceWorkerContextWrapper> wrapper_; 166 scoped_refptr<ServiceWorkerContextWrapper> wrapper_;
(...skipping 20 matching lines...) Expand all
186 message_port_message_filters_; 187 message_port_message_filters_;
187 188
188 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_; 189 base::WeakPtrFactory<EmbeddedWorkerTestHelper> weak_factory_;
189 190
190 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper); 191 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerTestHelper);
191 }; 192 };
192 193
193 } // namespace content 194 } // namespace content
194 195
195 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_ 196 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698