| 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 #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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 void DispatchBackgroundFetchedEvent( | 190 void DispatchBackgroundFetchedEvent( |
| 191 const std::string& tag, | 191 const std::string& tag, |
| 192 const std::vector<BackgroundFetchSettledFetch>& fetches, | 192 const std::vector<BackgroundFetchSettledFetch>& fetches, |
| 193 const DispatchBackgroundFetchedEventCallback& callback) override { | 193 const DispatchBackgroundFetchedEventCallback& callback) override { |
| 194 if (!helper_) | 194 if (!helper_) |
| 195 return; | 195 return; |
| 196 helper_->OnBackgroundFetchedEventStub(tag, fetches, callback); | 196 helper_->OnBackgroundFetchedEventStub(tag, fetches, callback); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void DispatchFetchEvent(int fetch_event_id, | 199 void DispatchFetchEvent( |
| 200 const ServiceWorkerFetchRequest& request, | 200 int fetch_event_id, |
| 201 mojom::FetchEventPreloadHandlePtr preload_handle, | 201 const ServiceWorkerFetchRequest& request, |
| 202 const DispatchFetchEventCallback& callback) override { | 202 mojom::FetchEventPreloadHandlePtr preload_handle, |
| 203 mojom::ServiceWorkerFetchResponseReceiverPtr response_receiver, |
| 204 const DispatchFetchEventCallback& callback) override { |
| 203 if (!helper_) | 205 if (!helper_) |
| 204 return; | 206 return; |
| 205 helper_->OnFetchEventStub(thread_id_, fetch_event_id, request, | 207 helper_->OnFetchEventStub(thread_id_, fetch_event_id, request, |
| 206 std::move(preload_handle), callback); | 208 std::move(preload_handle), callback); |
| 207 } | 209 } |
| 208 | 210 |
| 209 void DispatchNotificationClickEvent( | 211 void DispatchNotificationClickEvent( |
| 210 const std::string& notification_id, | 212 const std::string& notification_id, |
| 211 const PlatformNotificationData& notification_data, | 213 const PlatformNotificationData& notification_data, |
| 212 int action_index, | 214 int action_index, |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 474 } |
| 473 | 475 |
| 474 void EmbeddedWorkerTestHelper::OnFetchEvent( | 476 void EmbeddedWorkerTestHelper::OnFetchEvent( |
| 475 int embedded_worker_id, | 477 int embedded_worker_id, |
| 476 int fetch_event_id, | 478 int fetch_event_id, |
| 477 const ServiceWorkerFetchRequest& request, | 479 const ServiceWorkerFetchRequest& request, |
| 478 mojom::FetchEventPreloadHandlePtr preload_handle, | 480 mojom::FetchEventPreloadHandlePtr preload_handle, |
| 479 const FetchCallback& callback) { | 481 const FetchCallback& callback) { |
| 480 SimulateSend(new ServiceWorkerHostMsg_FetchEventResponse( | 482 SimulateSend(new ServiceWorkerHostMsg_FetchEventResponse( |
| 481 embedded_worker_id, fetch_event_id, | 483 embedded_worker_id, fetch_event_id, |
| 482 SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE, | |
| 483 ServiceWorkerResponse( | 484 ServiceWorkerResponse( |
| 484 base::MakeUnique<std::vector<GURL>>(), 200, "OK", | 485 base::MakeUnique<std::vector<GURL>>(), 200, "OK", |
| 485 blink::WebServiceWorkerResponseTypeDefault, | 486 blink::WebServiceWorkerResponseTypeDefault, |
| 486 base::MakeUnique<ServiceWorkerHeaderMap>(), std::string(), 0, GURL(), | 487 base::MakeUnique<ServiceWorkerHeaderMap>(), std::string(), 0, GURL(), |
| 487 blink::WebServiceWorkerResponseErrorUnknown, base::Time(), | 488 blink::WebServiceWorkerResponseErrorUnknown, base::Time(), |
| 488 false /* is_in_cache_storage */, | 489 false /* is_in_cache_storage */, |
| 489 std::string() /* cache_storage_cache_name */, | 490 std::string() /* cache_storage_cache_name */, |
| 490 base::MakeUnique< | 491 base::MakeUnique< |
| 491 ServiceWorkerHeaderList>() /* cors_exposed_header_names */), | 492 ServiceWorkerHeaderList>() /* cors_exposed_header_names */), |
| 492 base::Time::Now())); | 493 base::Time::Now())); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 base::Passed(std::move(app_request)), | 768 base::Passed(std::move(app_request)), |
| 768 base::Passed(std::move(response_callback)), callback)); | 769 base::Passed(std::move(response_callback)), callback)); |
| 769 } | 770 } |
| 770 | 771 |
| 771 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { | 772 EmbeddedWorkerRegistry* EmbeddedWorkerTestHelper::registry() { |
| 772 DCHECK(context()); | 773 DCHECK(context()); |
| 773 return context()->embedded_worker_registry(); | 774 return context()->embedded_worker_registry(); |
| 774 } | 775 } |
| 775 | 776 |
| 776 } // namespace content | 777 } // namespace content |
| OLD | NEW |