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

Side by Side Diff: content/browser/background_fetch/background_fetch_event_dispatcher_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 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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698