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

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

Issue 2002883002: ServiceWorker: Store the existence of fetch event handler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 #include "content/browser/service_worker/embedded_worker_test_helper.h" 5 #include "content/browser/service_worker/embedded_worker_test_helper.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 render_process_service_registry_.Bind(mojo::GetProxy(&services)); 106 render_process_service_registry_.Bind(mojo::GetProxy(&services));
107 host_service_registry->BindRemoteServiceProvider(std::move(services)); 107 host_service_registry->BindRemoteServiceProvider(std::move(services));
108 render_process_host_->SetServiceRegistry(std::move(host_service_registry)); 108 render_process_host_->SetServiceRegistry(std::move(host_service_registry));
109 } 109 }
110 110
111 EmbeddedWorkerTestHelper::~EmbeddedWorkerTestHelper() { 111 EmbeddedWorkerTestHelper::~EmbeddedWorkerTestHelper() {
112 if (wrapper_.get()) 112 if (wrapper_.get())
113 wrapper_->Shutdown(); 113 wrapper_->Shutdown();
114 } 114 }
115 115
116 void EmbeddedWorkerTestHelper::SimulateAddProcessToPattern(
falken 2016/05/23 08:41:13 mistake?
shimazu 2016/05/23 10:44:24 Oh,, This must be a mistake. I haven't found which
falken 2016/05/24 01:15:34 content_unittests I often run: out/Default/conten
shimazu 2016/05/24 04:17:46 Thank you, I'll do it.
117 const GURL& pattern, 116 const GURL& pattern,
118 int process_id) { 117 int process_id) {
119 registry()->AddChildProcessSender(process_id, this, 118 registry()->AddChildProcessSender(process_id, this,
120 NewMessagePortMessageFilter()); 119 NewMessagePortMessageFilter());
121 wrapper_->process_manager()->AddProcessReferenceToPattern( 120 wrapper_->process_manager()->AddProcessReferenceToPattern(
122 pattern, process_id); 121 pattern, process_id);
123 } 122 }
124 123
125 bool EmbeddedWorkerTestHelper::Send(IPC::Message* message) { 124 bool EmbeddedWorkerTestHelper::Send(IPC::Message* message) {
126 OnMessageReceived(*message); 125 OnMessageReceived(*message);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 SimulateSend(new ServiceWorkerHostMsg_ExtendableMessageEventFinished( 215 SimulateSend(new ServiceWorkerHostMsg_ExtendableMessageEventFinished(
217 embedded_worker_id, request_id, 216 embedded_worker_id, request_id,
218 blink::WebServiceWorkerEventResultCompleted)); 217 blink::WebServiceWorkerEventResultCompleted));
219 } 218 }
220 219
221 void EmbeddedWorkerTestHelper::OnInstallEvent(int embedded_worker_id, 220 void EmbeddedWorkerTestHelper::OnInstallEvent(int embedded_worker_id,
222 int request_id) { 221 int request_id) {
223 // The installing worker may have been doomed and terminated. 222 // The installing worker may have been doomed and terminated.
224 if (!registry()->GetWorker(embedded_worker_id)) 223 if (!registry()->GetWorker(embedded_worker_id))
225 return; 224 return;
226 SimulateSend( 225 SimulateSend(new ServiceWorkerHostMsg_InstallEventFinished(
227 new ServiceWorkerHostMsg_InstallEventFinished( 226 embedded_worker_id, request_id,
228 embedded_worker_id, request_id, 227 blink::WebServiceWorkerEventResultCompleted, true));
229 blink::WebServiceWorkerEventResultCompleted));
230 } 228 }
231 229
232 void EmbeddedWorkerTestHelper::OnFetchEvent( 230 void EmbeddedWorkerTestHelper::OnFetchEvent(
233 int embedded_worker_id, 231 int embedded_worker_id,
234 int request_id, 232 int request_id,
235 const ServiceWorkerFetchRequest& request) { 233 const ServiceWorkerFetchRequest& request) {
236 SimulateSend(new ServiceWorkerHostMsg_FetchEventFinished( 234 SimulateSend(new ServiceWorkerHostMsg_FetchEventFinished(
237 embedded_worker_id, request_id, 235 embedded_worker_id, request_id,
238 SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, 236 SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE,
239 ServiceWorkerResponse(GURL(), 200, "OK", 237 ServiceWorkerResponse(GURL(), 200, "OK",
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 435
438 MessagePortMessageFilter* 436 MessagePortMessageFilter*
439 EmbeddedWorkerTestHelper::NewMessagePortMessageFilter() { 437 EmbeddedWorkerTestHelper::NewMessagePortMessageFilter() {
440 scoped_refptr<MessagePortMessageFilter> filter( 438 scoped_refptr<MessagePortMessageFilter> filter(
441 new MockMessagePortMessageFilter); 439 new MockMessagePortMessageFilter);
442 message_port_message_filters_.push_back(filter); 440 message_port_message_filters_.push_back(filter);
443 return filter.get(); 441 return filter.get();
444 } 442 }
445 443
446 } // namespace content 444 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698