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

Side by Side Diff: content/browser/background_sync/background_sync_service_impl_unittest.cc

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: fix tests Created 3 years, 8 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 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 background_sync_context_->background_sync_manager() 155 background_sync_context_->background_sync_manager()
156 ->GetNetworkObserverForTesting(); 156 ->GetNetworkObserverForTesting();
157 network_observer->NotifyManagerIfNetworkChangedForTesting( 157 network_observer->NotifyManagerIfNetworkChangedForTesting(
158 net::NetworkChangeNotifier::CONNECTION_NONE); 158 net::NetworkChangeNotifier::CONNECTION_NONE);
159 base::RunLoop().RunUntilIdle(); 159 base::RunLoop().RunUntilIdle();
160 } 160 }
161 161
162 void CreateServiceWorkerRegistration() { 162 void CreateServiceWorkerRegistration() {
163 bool called = false; 163 bool called = false;
164 embedded_worker_helper_->context()->RegisterServiceWorker( 164 embedded_worker_helper_->context()->RegisterServiceWorker(
165 GURL(kServiceWorkerPattern), GURL(kServiceWorkerScript), NULL, 165 GURL(kServiceWorkerScript),
166 ServiceWorkerRegistrationOptions(GURL(kServiceWorkerPattern)), nullptr,
166 base::Bind(&RegisterServiceWorkerCallback, &called, 167 base::Bind(&RegisterServiceWorkerCallback, &called,
167 &sw_registration_id_)); 168 &sw_registration_id_));
168 base::RunLoop().RunUntilIdle(); 169 base::RunLoop().RunUntilIdle();
169 EXPECT_TRUE(called); 170 EXPECT_TRUE(called);
170 171
171 embedded_worker_helper_->context_wrapper()->FindReadyRegistrationForId( 172 embedded_worker_helper_->context_wrapper()->FindReadyRegistrationForId(
172 sw_registration_id_, GURL(kServiceWorkerPattern).GetOrigin(), 173 sw_registration_id_, GURL(kServiceWorkerPattern).GetOrigin(),
173 base::Bind(FindServiceWorkerRegistrationCallback, &sw_registration_)); 174 base::Bind(FindServiceWorkerRegistrationCallback, &sw_registration_));
174 base::RunLoop().RunUntilIdle(); 175 base::RunLoop().RunUntilIdle();
175 EXPECT_TRUE(sw_registration_); 176 EXPECT_TRUE(sw_registration_);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, register_error); 255 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, register_error);
255 GetRegistrations(base::Bind(&ErrorAndRegistrationListCallback, 256 GetRegistrations(base::Bind(&ErrorAndRegistrationListCallback,
256 &getregistrations_called, &getregistrations_error, 257 &getregistrations_called, &getregistrations_error,
257 &array_size)); 258 &array_size));
258 EXPECT_TRUE(getregistrations_called); 259 EXPECT_TRUE(getregistrations_called);
259 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, getregistrations_error); 260 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, getregistrations_error);
260 EXPECT_EQ(1UL, array_size); 261 EXPECT_EQ(1UL, array_size);
261 } 262 }
262 263
263 } // namespace content 264 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698