OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/background_fetch/background_fetch_event_dispatcher.h" | 5 #include "content/browser/background_fetch/background_fetch_event_dispatcher.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 scoped_refptr<ServiceWorkerRegistration> RegisterServiceWorker() { | 100 scoped_refptr<ServiceWorkerRegistration> RegisterServiceWorker() { |
101 GURL origin(kExampleOrigin); | 101 GURL origin(kExampleOrigin); |
102 GURL script_url(kExampleScriptUrl); | 102 GURL script_url(kExampleScriptUrl); |
103 | 103 |
104 int64_t service_worker_registration_id = | 104 int64_t service_worker_registration_id = |
105 kInvalidServiceWorkerRegistrationId; | 105 kInvalidServiceWorkerRegistrationId; |
106 | 106 |
107 { | 107 { |
108 base::RunLoop run_loop; | 108 base::RunLoop run_loop; |
109 embedded_worker_test_helper_.context()->RegisterServiceWorker( | 109 embedded_worker_test_helper_.context()->RegisterServiceWorker( |
110 origin, script_url, nullptr /* provider_host */, | 110 script_url, ServiceWorkerRegistrationOptions(origin), |
| 111 nullptr /* provider_host */, |
111 base::Bind( | 112 base::Bind( |
112 &BackgroundFetchEventDispatcherTest::DidRegisterServiceWorker, | 113 &BackgroundFetchEventDispatcherTest::DidRegisterServiceWorker, |
113 base::Unretained(this), &service_worker_registration_id, | 114 base::Unretained(this), &service_worker_registration_id, |
114 run_loop.QuitClosure())); | 115 run_loop.QuitClosure())); |
115 | 116 |
116 run_loop.Run(); | 117 run_loop.Run(); |
117 } | 118 } |
118 | 119 |
119 if (service_worker_registration_id == kInvalidServiceWorkerRegistrationId) { | 120 if (service_worker_registration_id == kInvalidServiceWorkerRegistrationId) { |
120 ADD_FAILURE() << "Could not obtain a valid Service Worker registration"; | 121 ADD_FAILURE() << "Could not obtain a valid Service Worker registration"; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 histogram_tester()->ExpectBucketCount( | 308 histogram_tester()->ExpectBucketCount( |
308 "BackgroundFetch.EventDispatchResult.ClickEvent", | 309 "BackgroundFetch.EventDispatchResult.ClickEvent", |
309 BackgroundFetchEventDispatcher::DISPATCH_RESULT_CANNOT_DISPATCH_EVENT, 1); | 310 BackgroundFetchEventDispatcher::DISPATCH_RESULT_CANNOT_DISPATCH_EVENT, 1); |
310 histogram_tester()->ExpectUniqueSample( | 311 histogram_tester()->ExpectUniqueSample( |
311 "BackgroundFetch.EventDispatchFailure.Dispatch.ClickEvent", | 312 "BackgroundFetch.EventDispatchFailure.Dispatch.ClickEvent", |
312 SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED, 1); | 313 SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED, 1); |
313 } | 314 } |
314 | 315 |
315 } // namespace | 316 } // namespace |
316 } // namespace content | 317 } // namespace content |
OLD | NEW |