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::Bind(&RegisterServiceWorkerCallback, &called, | 168 base::Bind(&RegisterServiceWorkerCallback, &called, |
168 &sw_registration_id_)); | 169 &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::Bind(FindServiceWorkerRegistrationCallback, &sw_registration_)); | 175 base::Bind(FindServiceWorkerRegistrationCallback, &sw_registration_)); |
175 base::RunLoop().RunUntilIdle(); | 176 base::RunLoop().RunUntilIdle(); |
176 EXPECT_TRUE(sw_registration_); | 177 EXPECT_TRUE(sw_registration_); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, register_error); | 257 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, register_error); |
257 GetRegistrations(base::Bind(&ErrorAndRegistrationListCallback, | 258 GetRegistrations(base::Bind(&ErrorAndRegistrationListCallback, |
258 &getregistrations_called, &getregistrations_error, | 259 &getregistrations_called, &getregistrations_error, |
259 &array_size)); | 260 &array_size)); |
260 EXPECT_TRUE(getregistrations_called); | 261 EXPECT_TRUE(getregistrations_called); |
261 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, getregistrations_error); | 262 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, getregistrations_error); |
262 EXPECT_EQ(1UL, array_size); | 263 EXPECT_EQ(1UL, array_size); |
263 } | 264 } |
264 | 265 |
265 } // namespace content | 266 } // namespace content |
OLD | NEW |