OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/service_worker/link_header_support.h" | 5 #include "content/browser/service_worker/link_header_support.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "content/browser/loader/resource_request_info_impl.h" | 10 #include "content/browser/loader/resource_request_info_impl.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 CreateProviderHostForServiceWorkerContext( | 111 CreateProviderHostForServiceWorkerContext( |
112 render_process_id(), kMockProviderId, | 112 render_process_id(), kMockProviderId, |
113 true /* is_parent_frame_secure */, context()->AsWeakPtr(), | 113 true /* is_parent_frame_secure */, context()->AsWeakPtr(), |
114 &remote_endpoints_.back()); | 114 &remote_endpoints_.back()); |
115 provider_host_ = host->AsWeakPtr(); | 115 provider_host_ = host->AsWeakPtr(); |
116 EXPECT_FALSE( | 116 EXPECT_FALSE( |
117 context()->GetProviderHost(host->process_id(), host->provider_id())); | 117 context()->GetProviderHost(host->process_id(), host->provider_id())); |
118 context()->AddProviderHost(std::move(host)); | 118 context()->AddProviderHost(std::move(host)); |
119 | 119 |
120 scoped_refptr<ServiceWorkerRegistration> registration = | 120 scoped_refptr<ServiceWorkerRegistration> registration = |
121 new ServiceWorkerRegistration(GURL("https://host/scope"), 1L, | 121 new ServiceWorkerRegistration( |
122 context()->AsWeakPtr()); | 122 ServiceWorkerRegistrationOptions(GURL("https://host/scope")), 1L, |
| 123 context()->AsWeakPtr()); |
123 scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion( | 124 scoped_refptr<ServiceWorkerVersion> version = new ServiceWorkerVersion( |
124 registration.get(), GURL("https://host/script.js"), 1L, | 125 registration.get(), GURL("https://host/script.js"), 1L, |
125 context()->AsWeakPtr()); | 126 context()->AsWeakPtr()); |
126 | 127 |
127 provider_host_->running_hosted_version_ = version; | 128 provider_host_->running_hosted_version_ = version; |
128 } | 129 } |
129 | 130 |
130 std::unique_ptr<net::URLRequest> CreateRequest(const GURL& request_url, | 131 std::unique_ptr<net::URLRequest> CreateRequest(const GURL& request_url, |
131 ResourceType resource_type, | 132 ResourceType resource_type, |
132 int provider_id) { | 133 int provider_id) { |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 provider_host()->provider_id()) | 443 provider_host()->provider_id()) |
443 .get(), | 444 .get(), |
444 "<../foo.js>; rel=serviceworker", context_wrapper()); | 445 "<../foo.js>; rel=serviceworker", context_wrapper()); |
445 base::RunLoop().RunUntilIdle(); | 446 base::RunLoop().RunUntilIdle(); |
446 | 447 |
447 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 448 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
448 ASSERT_EQ(1u, registrations.size()); | 449 ASSERT_EQ(1u, registrations.size()); |
449 } | 450 } |
450 | 451 |
451 } // namespace content | 452 } // namespace content |
OLD | NEW |