OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_sync/background_sync_service_impl.h" | 5 #include "content/browser/background_sync/background_sync_service_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 background_sync_context_->background_sync_manager() | 156 background_sync_context_->background_sync_manager() |
157 ->GetNetworkObserverForTesting(); | 157 ->GetNetworkObserverForTesting(); |
158 network_observer->NotifyManagerIfNetworkChangedForTesting( | 158 network_observer->NotifyManagerIfNetworkChangedForTesting( |
159 net::NetworkChangeNotifier::CONNECTION_NONE); | 159 net::NetworkChangeNotifier::CONNECTION_NONE); |
160 base::RunLoop().RunUntilIdle(); | 160 base::RunLoop().RunUntilIdle(); |
161 } | 161 } |
162 | 162 |
163 void CreateServiceWorkerRegistration() { | 163 void CreateServiceWorkerRegistration() { |
164 bool called = false; | 164 bool called = false; |
165 embedded_worker_helper_->context()->RegisterServiceWorker( | 165 embedded_worker_helper_->context()->RegisterServiceWorker( |
166 GURL(kServiceWorkerPattern), GURL(kServiceWorkerScript), NULL, | 166 GURL(kServiceWorkerScript), |
| 167 ServiceWorkerRegistrationOptions(GURL(kServiceWorkerPattern)), nullptr, |
167 base::AdaptCallbackForRepeating(base::BindOnce( | 168 base::AdaptCallbackForRepeating(base::BindOnce( |
168 &RegisterServiceWorkerCallback, &called, &sw_registration_id_))); | 169 &RegisterServiceWorkerCallback, &called, &sw_registration_id_))); |
169 base::RunLoop().RunUntilIdle(); | 170 base::RunLoop().RunUntilIdle(); |
170 EXPECT_TRUE(called); | 171 EXPECT_TRUE(called); |
171 | 172 |
172 embedded_worker_helper_->context_wrapper()->FindReadyRegistrationForId( | 173 embedded_worker_helper_->context_wrapper()->FindReadyRegistrationForId( |
173 sw_registration_id_, GURL(kServiceWorkerPattern).GetOrigin(), | 174 sw_registration_id_, GURL(kServiceWorkerPattern).GetOrigin(), |
174 base::AdaptCallbackForRepeating(base::BindOnce( | 175 base::AdaptCallbackForRepeating(base::BindOnce( |
175 FindServiceWorkerRegistrationCallback, &sw_registration_))); | 176 FindServiceWorkerRegistrationCallback, &sw_registration_))); |
176 base::RunLoop().RunUntilIdle(); | 177 base::RunLoop().RunUntilIdle(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, register_error); | 259 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, register_error); |
259 GetRegistrations(base::BindOnce(&ErrorAndRegistrationListCallback, | 260 GetRegistrations(base::BindOnce(&ErrorAndRegistrationListCallback, |
260 &get_registrations_called, | 261 &get_registrations_called, |
261 &getregistrations_error, &array_size)); | 262 &getregistrations_error, &array_size)); |
262 EXPECT_TRUE(get_registrations_called); | 263 EXPECT_TRUE(get_registrations_called); |
263 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, getregistrations_error); | 264 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, getregistrations_error); |
264 EXPECT_EQ(1UL, array_size); | 265 EXPECT_EQ(1UL, array_size); |
265 } | 266 } |
266 | 267 |
267 } // namespace content | 268 } // namespace content |
OLD | NEW |