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

Side by Side Diff: content/browser/background_fetch/background_fetch_test_base.cc

Issue 2968123002: Introduce ServiceWorkerRegistrationOptions struct for service worker options (Closed)
Patch Set: address more comments Created 3 years, 5 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_test_base.h" 5 #include "content/browser/background_fetch/background_fetch_test_base.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
15 #include "base/guid.h" 15 #include "base/guid.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/run_loop.h" 19 #include "base/run_loop.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "content/browser/background_fetch/background_fetch_registration_id.h" 21 #include "content/browser/background_fetch/background_fetch_registration_id.h"
22 #include "content/browser/service_worker/service_worker_context_core.h" 22 #include "content/browser/service_worker/service_worker_context_core.h"
23 #include "content/browser/service_worker/service_worker_registration.h" 23 #include "content/browser/service_worker/service_worker_registration.h"
24 #include "content/common/service_worker/service_worker_status_code.h" 24 #include "content/common/service_worker/service_worker_status_code.h"
25 #include "content/common/service_worker/service_worker_types.h"
25 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/download_item.h" 27 #include "content/public/browser/download_item.h"
27 #include "content/public/browser/download_url_parameters.h" 28 #include "content/public/browser/download_url_parameters.h"
28 #include "content/public/test/fake_download_item.h" 29 #include "content/public/test/fake_download_item.h"
29 #include "content/public/test/mock_download_manager.h" 30 #include "content/public/test/mock_download_manager.h"
30 #include "url/gurl.h" 31 #include "url/gurl.h"
31 32
32 namespace content { 33 namespace content {
33 34
34 namespace { 35 namespace {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 DCHECK(registration_id); 234 DCHECK(registration_id);
234 DCHECK(registration_id->is_null()); 235 DCHECK(registration_id->is_null());
235 236
236 GURL script_url(kTestScriptUrl); 237 GURL script_url(kTestScriptUrl);
237 238
238 int64_t service_worker_registration_id = kInvalidServiceWorkerRegistrationId; 239 int64_t service_worker_registration_id = kInvalidServiceWorkerRegistrationId;
239 240
240 { 241 {
241 base::RunLoop run_loop; 242 base::RunLoop run_loop;
242 embedded_worker_test_helper_.context()->RegisterServiceWorker( 243 embedded_worker_test_helper_.context()->RegisterServiceWorker(
243 origin_.GetURL(), script_url, nullptr /* provider_host */, 244 script_url, ServiceWorkerRegistrationOptions(origin_.GetURL()),
245 nullptr /* provider_host */,
244 base::Bind(&DidRegisterServiceWorker, &service_worker_registration_id, 246 base::Bind(&DidRegisterServiceWorker, &service_worker_registration_id,
245 run_loop.QuitClosure())); 247 run_loop.QuitClosure()));
246 248
247 run_loop.Run(); 249 run_loop.Run();
248 } 250 }
249 251
250 if (service_worker_registration_id == kInvalidServiceWorkerRegistrationId) { 252 if (service_worker_registration_id == kInvalidServiceWorkerRegistrationId) {
251 ADD_FAILURE() << "Could not obtain a valid Service Worker registration"; 253 ADD_FAILURE() << "Could not obtain a valid Service Worker registration";
252 return false; 254 return false;
253 } 255 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // Create a ServiceWorkerFetchRequest request with the same information. 295 // Create a ServiceWorkerFetchRequest request with the same information.
294 return ServiceWorkerFetchRequest(gurl, method, ServiceWorkerHeaderMap(), 296 return ServiceWorkerFetchRequest(gurl, method, ServiceWorkerHeaderMap(),
295 Referrer(), false /* is_reload */); 297 Referrer(), false /* is_reload */);
296 } 298 }
297 299
298 MockDownloadManager* BackgroundFetchTestBase::download_manager() { 300 MockDownloadManager* BackgroundFetchTestBase::download_manager() {
299 return download_manager_; 301 return download_manager_;
300 } 302 }
301 303
302 } // namespace content 304 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698