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" |
11 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 11 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
12 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 12 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
13 #include "content/browser/service_worker/service_worker_registration.h" | 13 #include "content/browser/service_worker/service_worker_registration.h" |
14 #include "content/browser/service_worker/service_worker_request_handler.h" | 14 #include "content/browser/service_worker/service_worker_request_handler.h" |
| 15 #include "content/browser/service_worker/service_worker_test_utils.h" |
15 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
16 #include "content/public/test/mock_resource_context.h" | 17 #include "content/public/test/mock_resource_context.h" |
17 #include "content/public/test/test_browser_thread_bundle.h" | 18 #include "content/public/test/test_browser_thread_bundle.h" |
18 #include "net/http/http_response_headers.h" | 19 #include "net/http/http_response_headers.h" |
19 #include "net/url_request/url_request_test_job.h" | 20 #include "net/url_request/url_request_test_job.h" |
20 #include "net/url_request/url_request_test_util.h" | 21 #include "net/url_request/url_request_test_util.h" |
21 #include "storage/browser/blob/blob_storage_context.h" | 22 #include "storage/browser/blob/blob_storage_context.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
23 | 24 |
24 namespace content { | 25 namespace content { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 private: | 123 private: |
123 TestBrowserThreadBundle thread_bundle_; | 124 TestBrowserThreadBundle thread_bundle_; |
124 std::unique_ptr<EmbeddedWorkerTestHelper> helper_; | 125 std::unique_ptr<EmbeddedWorkerTestHelper> helper_; |
125 net::TestURLRequestContext request_context_; | 126 net::TestURLRequestContext request_context_; |
126 net::TestDelegate request_delegate_; | 127 net::TestDelegate request_delegate_; |
127 MockResourceContext resource_context_; | 128 MockResourceContext resource_context_; |
128 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; | 129 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; |
129 storage::BlobStorageContext blob_storage_context_; | 130 storage::BlobStorageContext blob_storage_context_; |
130 }; | 131 }; |
131 | 132 |
132 TEST_F(LinkHeaderServiceWorkerTest, InstallServiceWorker_Basic) { | 133 class LinkHeaderServiceWorkerTestP |
| 134 : public MojoServiceWorkerTestP<LinkHeaderServiceWorkerTest> {}; |
| 135 |
| 136 TEST_P(LinkHeaderServiceWorkerTestP, InstallServiceWorker_Basic) { |
133 ProcessLinkHeaderForRequest( | 137 ProcessLinkHeaderForRequest( |
134 CreateSubresourceRequest(GURL("https://example.com/foo/bar/")).get(), | 138 CreateSubresourceRequest(GURL("https://example.com/foo/bar/")).get(), |
135 "<../foo.js>; rel=serviceworker", context_wrapper()); | 139 "<../foo.js>; rel=serviceworker", context_wrapper()); |
136 base::RunLoop().RunUntilIdle(); | 140 base::RunLoop().RunUntilIdle(); |
137 | 141 |
138 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 142 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
139 ASSERT_EQ(1u, registrations.size()); | 143 ASSERT_EQ(1u, registrations.size()); |
140 EXPECT_EQ(GURL("https://example.com/foo/"), registrations[0].pattern); | 144 EXPECT_EQ(GURL("https://example.com/foo/"), registrations[0].pattern); |
141 EXPECT_EQ(GURL("https://example.com/foo/foo.js"), | 145 EXPECT_EQ(GURL("https://example.com/foo/foo.js"), |
142 registrations[0].active_version.script_url); | 146 registrations[0].active_version.script_url); |
143 } | 147 } |
144 | 148 |
145 TEST_F(LinkHeaderServiceWorkerTest, InstallServiceWorker_ScopeWithFragment) { | 149 TEST_P(LinkHeaderServiceWorkerTestP, InstallServiceWorker_ScopeWithFragment) { |
146 ProcessLinkHeaderForRequest( | 150 ProcessLinkHeaderForRequest( |
147 CreateSubresourceRequest(GURL("https://example.com/foo/bar/")).get(), | 151 CreateSubresourceRequest(GURL("https://example.com/foo/bar/")).get(), |
148 "<../bar.js>; rel=serviceworker; scope=\"scope#ref\"", context_wrapper()); | 152 "<../bar.js>; rel=serviceworker; scope=\"scope#ref\"", context_wrapper()); |
149 base::RunLoop().RunUntilIdle(); | 153 base::RunLoop().RunUntilIdle(); |
150 | 154 |
151 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 155 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
152 ASSERT_EQ(1u, registrations.size()); | 156 ASSERT_EQ(1u, registrations.size()); |
153 EXPECT_EQ(GURL("https://example.com/foo/bar/scope"), | 157 EXPECT_EQ(GURL("https://example.com/foo/bar/scope"), |
154 registrations[0].pattern); | 158 registrations[0].pattern); |
155 EXPECT_EQ(GURL("https://example.com/foo/bar.js"), | 159 EXPECT_EQ(GURL("https://example.com/foo/bar.js"), |
156 registrations[0].active_version.script_url); | 160 registrations[0].active_version.script_url); |
157 } | 161 } |
158 | 162 |
159 TEST_F(LinkHeaderServiceWorkerTest, InstallServiceWorker_ScopeAbsoluteUrl) { | 163 TEST_P(LinkHeaderServiceWorkerTestP, InstallServiceWorker_ScopeAbsoluteUrl) { |
160 ProcessLinkHeaderForRequest( | 164 ProcessLinkHeaderForRequest( |
161 CreateSubresourceRequest(GURL("https://example.com/foo/bar/")).get(), | 165 CreateSubresourceRequest(GURL("https://example.com/foo/bar/")).get(), |
162 "<bar.js>; rel=serviceworker; " | 166 "<bar.js>; rel=serviceworker; " |
163 "scope=\"https://example.com:443/foo/bar/scope\"", | 167 "scope=\"https://example.com:443/foo/bar/scope\"", |
164 context_wrapper()); | 168 context_wrapper()); |
165 base::RunLoop().RunUntilIdle(); | 169 base::RunLoop().RunUntilIdle(); |
166 | 170 |
167 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 171 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
168 ASSERT_EQ(1u, registrations.size()); | 172 ASSERT_EQ(1u, registrations.size()); |
169 EXPECT_EQ(GURL("https://example.com/foo/bar/scope"), | 173 EXPECT_EQ(GURL("https://example.com/foo/bar/scope"), |
170 registrations[0].pattern); | 174 registrations[0].pattern); |
171 EXPECT_EQ(GURL("https://example.com/foo/bar/bar.js"), | 175 EXPECT_EQ(GURL("https://example.com/foo/bar/bar.js"), |
172 registrations[0].active_version.script_url); | 176 registrations[0].active_version.script_url); |
173 } | 177 } |
174 | 178 |
175 TEST_F(LinkHeaderServiceWorkerTest, InstallServiceWorker_ScopeDifferentOrigin) { | 179 TEST_P(LinkHeaderServiceWorkerTestP, |
| 180 InstallServiceWorker_ScopeDifferentOrigin) { |
176 ProcessLinkHeaderForRequest( | 181 ProcessLinkHeaderForRequest( |
177 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), | 182 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), |
178 "<bar.js>; rel=serviceworker; scope=\"https://google.com/scope\"", | 183 "<bar.js>; rel=serviceworker; scope=\"https://google.com/scope\"", |
179 context_wrapper()); | 184 context_wrapper()); |
180 base::RunLoop().RunUntilIdle(); | 185 base::RunLoop().RunUntilIdle(); |
181 | 186 |
182 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 187 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
183 ASSERT_EQ(0u, registrations.size()); | 188 ASSERT_EQ(0u, registrations.size()); |
184 } | 189 } |
185 | 190 |
186 TEST_F(LinkHeaderServiceWorkerTest, InstallServiceWorker_ScopeUrlEncodedSlash) { | 191 TEST_P(LinkHeaderServiceWorkerTestP, |
| 192 InstallServiceWorker_ScopeUrlEncodedSlash) { |
187 ProcessLinkHeaderForRequest( | 193 ProcessLinkHeaderForRequest( |
188 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), | 194 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), |
189 "<bar.js>; rel=serviceworker; scope=\"./foo%2Fbar\"", context_wrapper()); | 195 "<bar.js>; rel=serviceworker; scope=\"./foo%2Fbar\"", context_wrapper()); |
190 base::RunLoop().RunUntilIdle(); | 196 base::RunLoop().RunUntilIdle(); |
191 | 197 |
192 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 198 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
193 ASSERT_EQ(0u, registrations.size()); | 199 ASSERT_EQ(0u, registrations.size()); |
194 } | 200 } |
195 | 201 |
196 TEST_F(LinkHeaderServiceWorkerTest, | 202 TEST_P(LinkHeaderServiceWorkerTestP, |
197 InstallServiceWorker_ScriptUrlEncodedSlash) { | 203 InstallServiceWorker_ScriptUrlEncodedSlash) { |
198 ProcessLinkHeaderForRequest( | 204 ProcessLinkHeaderForRequest( |
199 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), | 205 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), |
200 "<foo%2Fbar.js>; rel=serviceworker", context_wrapper()); | 206 "<foo%2Fbar.js>; rel=serviceworker", context_wrapper()); |
201 base::RunLoop().RunUntilIdle(); | 207 base::RunLoop().RunUntilIdle(); |
202 | 208 |
203 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 209 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
204 ASSERT_EQ(0u, registrations.size()); | 210 ASSERT_EQ(0u, registrations.size()); |
205 } | 211 } |
206 | 212 |
207 TEST_F(LinkHeaderServiceWorkerTest, InstallServiceWorker_ScriptAbsoluteUrl) { | 213 TEST_P(LinkHeaderServiceWorkerTestP, InstallServiceWorker_ScriptAbsoluteUrl) { |
208 ProcessLinkHeaderForRequest( | 214 ProcessLinkHeaderForRequest( |
209 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), | 215 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), |
210 "<https://example.com/bar.js>; rel=serviceworker; scope=foo", | 216 "<https://example.com/bar.js>; rel=serviceworker; scope=foo", |
211 context_wrapper()); | 217 context_wrapper()); |
212 base::RunLoop().RunUntilIdle(); | 218 base::RunLoop().RunUntilIdle(); |
213 | 219 |
214 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 220 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
215 ASSERT_EQ(1u, registrations.size()); | 221 ASSERT_EQ(1u, registrations.size()); |
216 EXPECT_EQ(GURL("https://example.com/foobar/foo"), registrations[0].pattern); | 222 EXPECT_EQ(GURL("https://example.com/foobar/foo"), registrations[0].pattern); |
217 EXPECT_EQ(GURL("https://example.com/bar.js"), | 223 EXPECT_EQ(GURL("https://example.com/bar.js"), |
218 registrations[0].active_version.script_url); | 224 registrations[0].active_version.script_url); |
219 } | 225 } |
220 | 226 |
221 TEST_F(LinkHeaderServiceWorkerTest, | 227 TEST_P(LinkHeaderServiceWorkerTestP, |
222 InstallServiceWorker_ScriptDifferentOrigin) { | 228 InstallServiceWorker_ScriptDifferentOrigin) { |
223 ProcessLinkHeaderForRequest( | 229 ProcessLinkHeaderForRequest( |
224 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), | 230 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), |
225 "<https://google.com/bar.js>; rel=serviceworker; scope=foo", | 231 "<https://google.com/bar.js>; rel=serviceworker; scope=foo", |
226 context_wrapper()); | 232 context_wrapper()); |
227 base::RunLoop().RunUntilIdle(); | 233 base::RunLoop().RunUntilIdle(); |
228 | 234 |
229 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 235 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
230 ASSERT_EQ(0u, registrations.size()); | 236 ASSERT_EQ(0u, registrations.size()); |
231 } | 237 } |
232 | 238 |
233 TEST_F(LinkHeaderServiceWorkerTest, InstallServiceWorker_MultipleWorkers) { | 239 TEST_P(LinkHeaderServiceWorkerTestP, InstallServiceWorker_MultipleWorkers) { |
234 ProcessLinkHeaderForRequest( | 240 ProcessLinkHeaderForRequest( |
235 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), | 241 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), |
236 "<bar.js>; rel=serviceworker; scope=foo, <baz.js>; " | 242 "<bar.js>; rel=serviceworker; scope=foo, <baz.js>; " |
237 "rel=serviceworker; scope=scope", | 243 "rel=serviceworker; scope=scope", |
238 context_wrapper()); | 244 context_wrapper()); |
239 base::RunLoop().RunUntilIdle(); | 245 base::RunLoop().RunUntilIdle(); |
240 | 246 |
241 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 247 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
242 ASSERT_EQ(2u, registrations.size()); | 248 ASSERT_EQ(2u, registrations.size()); |
243 EXPECT_EQ(GURL("https://example.com/foobar/foo"), registrations[0].pattern); | 249 EXPECT_EQ(GURL("https://example.com/foobar/foo"), registrations[0].pattern); |
244 EXPECT_EQ(GURL("https://example.com/foobar/bar.js"), | 250 EXPECT_EQ(GURL("https://example.com/foobar/bar.js"), |
245 registrations[0].active_version.script_url); | 251 registrations[0].active_version.script_url); |
246 EXPECT_EQ(GURL("https://example.com/foobar/scope"), registrations[1].pattern); | 252 EXPECT_EQ(GURL("https://example.com/foobar/scope"), registrations[1].pattern); |
247 EXPECT_EQ(GURL("https://example.com/foobar/baz.js"), | 253 EXPECT_EQ(GURL("https://example.com/foobar/baz.js"), |
248 registrations[1].active_version.script_url); | 254 registrations[1].active_version.script_url); |
249 } | 255 } |
250 | 256 |
251 TEST_F(LinkHeaderServiceWorkerTest, | 257 TEST_P(LinkHeaderServiceWorkerTestP, |
252 InstallServiceWorker_ValidAndInvalidValues) { | 258 InstallServiceWorker_ValidAndInvalidValues) { |
253 ProcessLinkHeaderForRequest( | 259 ProcessLinkHeaderForRequest( |
254 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), | 260 CreateSubresourceRequest(GURL("https://example.com/foobar/")).get(), |
255 "<https://google.com/bar.js>; rel=serviceworker; scope=foo, <baz.js>; " | 261 "<https://google.com/bar.js>; rel=serviceworker; scope=foo, <baz.js>; " |
256 "rel=serviceworker; scope=scope", | 262 "rel=serviceworker; scope=scope", |
257 context_wrapper()); | 263 context_wrapper()); |
258 base::RunLoop().RunUntilIdle(); | 264 base::RunLoop().RunUntilIdle(); |
259 | 265 |
260 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 266 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
261 ASSERT_EQ(1u, registrations.size()); | 267 ASSERT_EQ(1u, registrations.size()); |
262 EXPECT_EQ(GURL("https://example.com/foobar/scope"), registrations[0].pattern); | 268 EXPECT_EQ(GURL("https://example.com/foobar/scope"), registrations[0].pattern); |
263 EXPECT_EQ(GURL("https://example.com/foobar/baz.js"), | 269 EXPECT_EQ(GURL("https://example.com/foobar/baz.js"), |
264 registrations[0].active_version.script_url); | 270 registrations[0].active_version.script_url); |
265 } | 271 } |
266 | 272 |
267 TEST_F(LinkHeaderServiceWorkerTest, InstallServiceWorker_InsecureContext) { | 273 TEST_P(LinkHeaderServiceWorkerTestP, InstallServiceWorker_InsecureContext) { |
268 std::unique_ptr<net::URLRequest> request = | 274 std::unique_ptr<net::URLRequest> request = |
269 CreateSubresourceRequest(GURL("https://example.com/foo/bar/")); | 275 CreateSubresourceRequest(GURL("https://example.com/foo/bar/")); |
270 ResourceRequestInfoImpl::ForRequest(request.get()) | 276 ResourceRequestInfoImpl::ForRequest(request.get()) |
271 ->set_initiated_in_secure_context_for_testing(false); | 277 ->set_initiated_in_secure_context_for_testing(false); |
272 ProcessLinkHeaderForRequest(request.get(), "<../foo.js>; rel=serviceworker", | 278 ProcessLinkHeaderForRequest(request.get(), "<../foo.js>; rel=serviceworker", |
273 context_wrapper()); | 279 context_wrapper()); |
274 base::RunLoop().RunUntilIdle(); | 280 base::RunLoop().RunUntilIdle(); |
275 | 281 |
276 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 282 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
277 ASSERT_EQ(0u, registrations.size()); | 283 ASSERT_EQ(0u, registrations.size()); |
278 } | 284 } |
279 | 285 |
280 TEST_F(LinkHeaderServiceWorkerTest, | 286 TEST_P(LinkHeaderServiceWorkerTestP, |
281 InstallServiceWorker_NavigationFromInsecureContextToSecureContext) { | 287 InstallServiceWorker_NavigationFromInsecureContextToSecureContext) { |
282 std::unique_ptr<net::URLRequest> request = CreateRequest( | 288 std::unique_ptr<net::URLRequest> request = CreateRequest( |
283 GURL("https://example.com/foo/bar/"), RESOURCE_TYPE_MAIN_FRAME); | 289 GURL("https://example.com/foo/bar/"), RESOURCE_TYPE_MAIN_FRAME); |
284 ResourceRequestInfoImpl::ForRequest(request.get()) | 290 ResourceRequestInfoImpl::ForRequest(request.get()) |
285 ->set_initiated_in_secure_context_for_testing(false); | 291 ->set_initiated_in_secure_context_for_testing(false); |
286 | 292 |
287 provider_host()->SetDocumentUrl(GURL("https://example.com/foo/bar/")); | 293 provider_host()->SetDocumentUrl(GURL("https://example.com/foo/bar/")); |
288 provider_host()->set_parent_frame_secure(true); | 294 provider_host()->set_parent_frame_secure(true); |
289 | 295 |
290 ProcessLinkHeaderForRequest(request.get(), "<../foo.js>; rel=serviceworker", | 296 ProcessLinkHeaderForRequest(request.get(), "<../foo.js>; rel=serviceworker", |
291 context_wrapper()); | 297 context_wrapper()); |
292 base::RunLoop().RunUntilIdle(); | 298 base::RunLoop().RunUntilIdle(); |
293 | 299 |
294 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 300 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
295 ASSERT_EQ(1u, registrations.size()); | 301 ASSERT_EQ(1u, registrations.size()); |
296 EXPECT_EQ(GURL("https://example.com/foo/"), registrations[0].pattern); | 302 EXPECT_EQ(GURL("https://example.com/foo/"), registrations[0].pattern); |
297 EXPECT_EQ(GURL("https://example.com/foo/foo.js"), | 303 EXPECT_EQ(GURL("https://example.com/foo/foo.js"), |
298 registrations[0].active_version.script_url); | 304 registrations[0].active_version.script_url); |
299 } | 305 } |
300 | 306 |
301 TEST_F(LinkHeaderServiceWorkerTest, | 307 TEST_P(LinkHeaderServiceWorkerTestP, |
302 InstallServiceWorker_NavigationToInsecureContext) { | 308 InstallServiceWorker_NavigationToInsecureContext) { |
303 provider_host()->SetDocumentUrl(GURL("http://example.com/foo/bar/")); | 309 provider_host()->SetDocumentUrl(GURL("http://example.com/foo/bar/")); |
304 provider_host()->set_parent_frame_secure(true); | 310 provider_host()->set_parent_frame_secure(true); |
305 ProcessLinkHeaderForRequest(CreateRequest(GURL("http://example.com/foo/bar/"), | 311 ProcessLinkHeaderForRequest(CreateRequest(GURL("http://example.com/foo/bar/"), |
306 RESOURCE_TYPE_MAIN_FRAME) | 312 RESOURCE_TYPE_MAIN_FRAME) |
307 .get(), | 313 .get(), |
308 "<../foo.js>; rel=serviceworker", | 314 "<../foo.js>; rel=serviceworker", |
309 context_wrapper()); | 315 context_wrapper()); |
310 base::RunLoop().RunUntilIdle(); | 316 base::RunLoop().RunUntilIdle(); |
311 | 317 |
312 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 318 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
313 ASSERT_EQ(0u, registrations.size()); | 319 ASSERT_EQ(0u, registrations.size()); |
314 } | 320 } |
315 | 321 |
316 TEST_F(LinkHeaderServiceWorkerTest, | 322 TEST_P(LinkHeaderServiceWorkerTestP, |
317 InstallServiceWorker_NavigationToInsecureHttpsContext) { | 323 InstallServiceWorker_NavigationToInsecureHttpsContext) { |
318 provider_host()->SetDocumentUrl(GURL("https://example.com/foo/bar/")); | 324 provider_host()->SetDocumentUrl(GURL("https://example.com/foo/bar/")); |
319 provider_host()->set_parent_frame_secure(false); | 325 provider_host()->set_parent_frame_secure(false); |
320 ProcessLinkHeaderForRequest( | 326 ProcessLinkHeaderForRequest( |
321 CreateRequest(GURL("https://example.com/foo/bar/"), | 327 CreateRequest(GURL("https://example.com/foo/bar/"), |
322 RESOURCE_TYPE_MAIN_FRAME) | 328 RESOURCE_TYPE_MAIN_FRAME) |
323 .get(), | 329 .get(), |
324 "<../foo.js>; rel=serviceworker", context_wrapper()); | 330 "<../foo.js>; rel=serviceworker", context_wrapper()); |
325 base::RunLoop().RunUntilIdle(); | 331 base::RunLoop().RunUntilIdle(); |
326 | 332 |
327 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); | 333 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); |
328 ASSERT_EQ(0u, registrations.size()); | 334 ASSERT_EQ(0u, registrations.size()); |
329 } | 335 } |
330 | 336 |
| 337 INSTANTIATE_TEST_CASE_P(LinkHeaderServiceWorkerTest, |
| 338 LinkHeaderServiceWorkerTestP, |
| 339 testing::Bool()); |
| 340 |
331 } // namespace | 341 } // namespace |
332 | 342 |
333 } // namespace content | 343 } // namespace content |
OLD | NEW |