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/loader/url_loader_factory_impl.h" | 5 #include "content/browser/loader/url_loader_factory_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "content/browser/loader/mojo_async_resource_handler.h" | 25 #include "content/browser/loader/mojo_async_resource_handler.h" |
26 #include "content/browser/loader/navigation_resource_throttle.h" | 26 #include "content/browser/loader/navigation_resource_throttle.h" |
27 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 27 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
28 #include "content/browser/loader/resource_message_filter.h" | 28 #include "content/browser/loader/resource_message_filter.h" |
29 #include "content/browser/loader/resource_request_info_impl.h" | 29 #include "content/browser/loader/resource_request_info_impl.h" |
30 #include "content/browser/loader/test_url_loader_client.h" | 30 #include "content/browser/loader/test_url_loader_client.h" |
31 #include "content/browser/loader_delegate_impl.h" | 31 #include "content/browser/loader_delegate_impl.h" |
32 #include "content/common/resource_request.h" | 32 #include "content/common/resource_request.h" |
33 #include "content/common/resource_request_completion_status.h" | 33 #include "content/common/resource_request_completion_status.h" |
34 #include "content/common/url_loader.mojom.h" | 34 #include "content/common/url_loader.mojom.h" |
| 35 #include "content/common/url_loader_factory.mojom.h" |
35 #include "content/public/browser/resource_context.h" | 36 #include "content/public/browser/resource_context.h" |
36 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 37 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
37 #include "content/public/common/content_paths.h" | 38 #include "content/public/common/content_paths.h" |
38 #include "content/public/test/test_browser_context.h" | 39 #include "content/public/test/test_browser_context.h" |
39 #include "content/public/test/test_browser_thread_bundle.h" | 40 #include "content/public/test/test_browser_thread_bundle.h" |
40 #include "mojo/public/c/system/data_pipe.h" | 41 #include "mojo/public/c/system/data_pipe.h" |
41 #include "mojo/public/c/system/types.h" | 42 #include "mojo/public/c/system/types.h" |
42 #include "mojo/public/cpp/bindings/binding.h" | 43 #include "mojo/public/cpp/bindings/binding.h" |
43 #include "mojo/public/cpp/system/data_pipe.h" | 44 #include "mojo/public/cpp/system/data_pipe.h" |
44 #include "net/base/io_buffer.h" | 45 #include "net/base/io_buffer.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // Assume the file contents is small enough to be stored in the data pipe. | 159 // Assume the file contents is small enough to be stored in the data pipe. |
159 request.url = net::URLRequestMockHTTPJob::GetMockUrl("hello.html"); | 160 request.url = net::URLRequestMockHTTPJob::GetMockUrl("hello.html"); |
160 request.method = "GET"; | 161 request.method = "GET"; |
161 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 162 // |resource_type| can't be a frame type. It is because when PlzNavigate is |
162 // enabled, the url scheme of frame type requests from the renderer process | 163 // enabled, the url scheme of frame type requests from the renderer process |
163 // must be blob scheme. | 164 // must be blob scheme. |
164 request.resource_type = RESOURCE_TYPE_XHR; | 165 request.resource_type = RESOURCE_TYPE_XHR; |
165 // Need to set |request_initiator| for non main frame type request. | 166 // Need to set |request_initiator| for non main frame type request. |
166 request.request_initiator = url::Origin(); | 167 request.request_initiator = url::Origin(); |
167 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), kRoutingId, | 168 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), kRoutingId, |
168 kRequestId, request, | 169 kRequestId, mojom::kURLLoadOptionNone, request, |
169 client.CreateInterfacePtr()); | 170 client.CreateInterfacePtr()); |
170 | 171 |
171 ASSERT_FALSE(client.has_received_response()); | 172 ASSERT_FALSE(client.has_received_response()); |
172 ASSERT_FALSE(client.response_body().is_valid()); | 173 ASSERT_FALSE(client.response_body().is_valid()); |
173 ASSERT_FALSE(client.has_received_completion()); | 174 ASSERT_FALSE(client.has_received_completion()); |
174 | 175 |
175 client.RunUntilResponseReceived(); | 176 client.RunUntilResponseReceived(); |
176 | 177 |
177 net::URLRequest* url_request = | 178 net::URLRequest* url_request = |
178 rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId)); | 179 rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId)); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 net::URLRequestFailedJob::AddUrlHandler(); | 234 net::URLRequestFailedJob::AddUrlHandler(); |
234 request.url = net::URLRequestFailedJob::GetMockHttpUrlWithFailurePhase( | 235 request.url = net::URLRequestFailedJob::GetMockHttpUrlWithFailurePhase( |
235 net::URLRequestFailedJob::START, net::ERR_TIMED_OUT); | 236 net::URLRequestFailedJob::START, net::ERR_TIMED_OUT); |
236 request.method = "GET"; | 237 request.method = "GET"; |
237 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 238 // |resource_type| can't be a frame type. It is because when PlzNavigate is |
238 // enabled, the url scheme of frame type requests from the renderer process | 239 // enabled, the url scheme of frame type requests from the renderer process |
239 // must be blob scheme. | 240 // must be blob scheme. |
240 request.resource_type = RESOURCE_TYPE_XHR; | 241 request.resource_type = RESOURCE_TYPE_XHR; |
241 // Need to set |request_initiator| for non main frame type request. | 242 // Need to set |request_initiator| for non main frame type request. |
242 request.request_initiator = url::Origin(); | 243 request.request_initiator = url::Origin(); |
243 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), 2, 1, request, | 244 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), 2, 1, |
| 245 mojom::kURLLoadOptionNone, request, |
244 client.CreateInterfacePtr()); | 246 client.CreateInterfacePtr()); |
245 | 247 |
246 client.RunUntilComplete(); | 248 client.RunUntilComplete(); |
247 ASSERT_FALSE(client.has_received_response()); | 249 ASSERT_FALSE(client.has_received_response()); |
248 ASSERT_FALSE(client.response_body().is_valid()); | 250 ASSERT_FALSE(client.response_body().is_valid()); |
249 | 251 |
250 EXPECT_EQ(net::ERR_TIMED_OUT, client.completion_status().error_code); | 252 EXPECT_EQ(net::ERR_TIMED_OUT, client.completion_status().error_code); |
251 EXPECT_EQ(0, client.completion_status().encoded_data_length); | 253 EXPECT_EQ(0, client.completion_status().encoded_data_length); |
252 EXPECT_EQ(0, client.completion_status().encoded_body_length); | 254 EXPECT_EQ(0, client.completion_status().encoded_body_length); |
253 } | 255 } |
254 | 256 |
255 // In this case, the loading fails after receiving a response. | 257 // In this case, the loading fails after receiving a response. |
256 TEST_P(URLLoaderFactoryImplTest, GetFailedResponse2) { | 258 TEST_P(URLLoaderFactoryImplTest, GetFailedResponse2) { |
257 NavigationResourceThrottle::set_ui_checks_always_succeed_for_testing(true); | 259 NavigationResourceThrottle::set_ui_checks_always_succeed_for_testing(true); |
258 mojom::URLLoaderAssociatedPtr loader; | 260 mojom::URLLoaderAssociatedPtr loader; |
259 ResourceRequest request; | 261 ResourceRequest request; |
260 TestURLLoaderClient client; | 262 TestURLLoaderClient client; |
261 net::URLRequestFailedJob::AddUrlHandler(); | 263 net::URLRequestFailedJob::AddUrlHandler(); |
262 request.url = net::URLRequestFailedJob::GetMockHttpUrlWithFailurePhase( | 264 request.url = net::URLRequestFailedJob::GetMockHttpUrlWithFailurePhase( |
263 net::URLRequestFailedJob::READ_ASYNC, net::ERR_TIMED_OUT); | 265 net::URLRequestFailedJob::READ_ASYNC, net::ERR_TIMED_OUT); |
264 request.method = "GET"; | 266 request.method = "GET"; |
265 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 267 // |resource_type| can't be a frame type. It is because when PlzNavigate is |
266 // enabled, the url scheme of frame type requests from the renderer process | 268 // enabled, the url scheme of frame type requests from the renderer process |
267 // must be blob scheme. | 269 // must be blob scheme. |
268 request.resource_type = RESOURCE_TYPE_XHR; | 270 request.resource_type = RESOURCE_TYPE_XHR; |
269 // Need to set |request_initiator| for non main frame type request. | 271 // Need to set |request_initiator| for non main frame type request. |
270 request.request_initiator = url::Origin(); | 272 request.request_initiator = url::Origin(); |
271 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), 2, 1, request, | 273 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), 2, 1, |
| 274 mojom::kURLLoadOptionNone, request, |
272 client.CreateInterfacePtr()); | 275 client.CreateInterfacePtr()); |
273 | 276 |
274 client.RunUntilComplete(); | 277 client.RunUntilComplete(); |
275 ASSERT_FALSE(client.has_received_response()); | 278 ASSERT_FALSE(client.has_received_response()); |
276 ASSERT_FALSE(client.response_body().is_valid()); | 279 ASSERT_FALSE(client.response_body().is_valid()); |
277 | 280 |
278 EXPECT_EQ(net::ERR_TIMED_OUT, client.completion_status().error_code); | 281 EXPECT_EQ(net::ERR_TIMED_OUT, client.completion_status().error_code); |
279 EXPECT_GT(client.completion_status().encoded_data_length, 0); | 282 EXPECT_GT(client.completion_status().encoded_data_length, 0); |
280 EXPECT_EQ(0, client.completion_status().encoded_body_length); | 283 EXPECT_EQ(0, client.completion_status().encoded_body_length); |
281 } | 284 } |
282 | 285 |
283 // This test tests a case where resource loading is cancelled before started. | 286 // This test tests a case where resource loading is cancelled before started. |
284 TEST_P(URLLoaderFactoryImplTest, InvalidURL) { | 287 TEST_P(URLLoaderFactoryImplTest, InvalidURL) { |
285 mojom::URLLoaderAssociatedPtr loader; | 288 mojom::URLLoaderAssociatedPtr loader; |
286 ResourceRequest request; | 289 ResourceRequest request; |
287 TestURLLoaderClient client; | 290 TestURLLoaderClient client; |
288 request.url = GURL(); | 291 request.url = GURL(); |
289 request.method = "GET"; | 292 request.method = "GET"; |
290 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 293 // |resource_type| can't be a frame type. It is because when PlzNavigate is |
291 // enabled, the url scheme of frame type requests from the renderer process | 294 // enabled, the url scheme of frame type requests from the renderer process |
292 // must be blob scheme. | 295 // must be blob scheme. |
293 request.resource_type = RESOURCE_TYPE_XHR; | 296 request.resource_type = RESOURCE_TYPE_XHR; |
294 // Need to set |request_initiator| for non main frame type request. | 297 // Need to set |request_initiator| for non main frame type request. |
295 request.request_initiator = url::Origin(); | 298 request.request_initiator = url::Origin(); |
296 ASSERT_FALSE(request.url.is_valid()); | 299 ASSERT_FALSE(request.url.is_valid()); |
297 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), 2, 1, request, | 300 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), 2, 1, |
| 301 mojom::kURLLoadOptionNone, request, |
298 client.CreateInterfacePtr()); | 302 client.CreateInterfacePtr()); |
299 | 303 |
300 client.RunUntilComplete(); | 304 client.RunUntilComplete(); |
301 ASSERT_FALSE(client.has_received_response()); | 305 ASSERT_FALSE(client.has_received_response()); |
302 ASSERT_FALSE(client.response_body().is_valid()); | 306 ASSERT_FALSE(client.response_body().is_valid()); |
303 | 307 |
304 EXPECT_EQ(net::ERR_ABORTED, client.completion_status().error_code); | 308 EXPECT_EQ(net::ERR_ABORTED, client.completion_status().error_code); |
305 } | 309 } |
306 | 310 |
307 // This test tests a case where resource loading is cancelled before started. | 311 // This test tests a case where resource loading is cancelled before started. |
308 TEST_P(URLLoaderFactoryImplTest, ShouldNotRequestURL) { | 312 TEST_P(URLLoaderFactoryImplTest, ShouldNotRequestURL) { |
309 mojom::URLLoaderAssociatedPtr loader; | 313 mojom::URLLoaderAssociatedPtr loader; |
310 RejectingResourceDispatcherHostDelegate rdh_delegate; | 314 RejectingResourceDispatcherHostDelegate rdh_delegate; |
311 rdh_.SetDelegate(&rdh_delegate); | 315 rdh_.SetDelegate(&rdh_delegate); |
312 ResourceRequest request; | 316 ResourceRequest request; |
313 TestURLLoaderClient client; | 317 TestURLLoaderClient client; |
314 request.url = GURL("http://localhost/"); | 318 request.url = GURL("http://localhost/"); |
315 request.method = "GET"; | 319 request.method = "GET"; |
316 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 320 // |resource_type| can't be a frame type. It is because when PlzNavigate is |
317 // enabled, the url scheme of frame type requests from the renderer process | 321 // enabled, the url scheme of frame type requests from the renderer process |
318 // must be blob scheme. | 322 // must be blob scheme. |
319 request.resource_type = RESOURCE_TYPE_XHR; | 323 request.resource_type = RESOURCE_TYPE_XHR; |
320 // Need to set |request_initiator| for non main frame type request. | 324 // Need to set |request_initiator| for non main frame type request. |
321 request.request_initiator = url::Origin(); | 325 request.request_initiator = url::Origin(); |
322 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), 2, 1, request, | 326 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), 2, 1, |
| 327 mojom::kURLLoadOptionNone, request, |
323 client.CreateInterfacePtr()); | 328 client.CreateInterfacePtr()); |
324 | 329 |
325 client.RunUntilComplete(); | 330 client.RunUntilComplete(); |
326 rdh_.SetDelegate(nullptr); | 331 rdh_.SetDelegate(nullptr); |
327 | 332 |
328 ASSERT_FALSE(client.has_received_response()); | 333 ASSERT_FALSE(client.has_received_response()); |
329 ASSERT_FALSE(client.response_body().is_valid()); | 334 ASSERT_FALSE(client.response_body().is_valid()); |
330 | 335 |
331 EXPECT_EQ(net::ERR_ABORTED, client.completion_status().error_code); | 336 EXPECT_EQ(net::ERR_ABORTED, client.completion_status().error_code); |
332 } | 337 } |
333 | 338 |
334 TEST_P(URLLoaderFactoryImplTest, DownloadToFile) { | 339 TEST_P(URLLoaderFactoryImplTest, DownloadToFile) { |
335 constexpr int32_t kRoutingId = 1; | 340 constexpr int32_t kRoutingId = 1; |
336 constexpr int32_t kRequestId = 2; | 341 constexpr int32_t kRequestId = 2; |
337 | 342 |
338 mojom::URLLoaderAssociatedPtr loader; | 343 mojom::URLLoaderAssociatedPtr loader; |
339 base::FilePath root; | 344 base::FilePath root; |
340 PathService::Get(DIR_TEST_DATA, &root); | 345 PathService::Get(DIR_TEST_DATA, &root); |
341 net::URLRequestMockHTTPJob::AddUrlHandlers(root, | 346 net::URLRequestMockHTTPJob::AddUrlHandlers(root, |
342 BrowserThread::GetBlockingPool()); | 347 BrowserThread::GetBlockingPool()); |
343 | 348 |
344 ResourceRequest request; | 349 ResourceRequest request; |
345 TestURLLoaderClient client; | 350 TestURLLoaderClient client; |
346 request.url = net::URLRequestMockHTTPJob::GetMockUrl("hello.html"); | 351 request.url = net::URLRequestMockHTTPJob::GetMockUrl("hello.html"); |
347 request.method = "GET"; | 352 request.method = "GET"; |
348 request.resource_type = RESOURCE_TYPE_XHR; | 353 request.resource_type = RESOURCE_TYPE_XHR; |
349 request.download_to_file = true; | 354 request.download_to_file = true; |
350 request.request_initiator = url::Origin(); | 355 request.request_initiator = url::Origin(); |
351 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), kRoutingId, | 356 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), kRoutingId, |
352 kRequestId, request, | 357 kRequestId, 0, request, |
353 client.CreateInterfacePtr()); | 358 client.CreateInterfacePtr()); |
354 ASSERT_FALSE(client.has_received_response()); | 359 ASSERT_FALSE(client.has_received_response()); |
355 ASSERT_FALSE(client.has_data_downloaded()); | 360 ASSERT_FALSE(client.has_data_downloaded()); |
356 ASSERT_FALSE(client.has_received_completion()); | 361 ASSERT_FALSE(client.has_received_completion()); |
357 | 362 |
358 client.RunUntilResponseReceived(); | 363 client.RunUntilResponseReceived(); |
359 | 364 |
360 net::URLRequest* url_request = | 365 net::URLRequest* url_request = |
361 rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId)); | 366 rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId)); |
362 ASSERT_TRUE(url_request); | 367 ASSERT_TRUE(url_request); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 net::URLRequestSlowDownloadJob::AddUrlHandler(); | 414 net::URLRequestSlowDownloadJob::AddUrlHandler(); |
410 | 415 |
411 ResourceRequest request; | 416 ResourceRequest request; |
412 TestURLLoaderClient client; | 417 TestURLLoaderClient client; |
413 request.url = GURL(net::URLRequestSlowDownloadJob::kKnownSizeUrl); | 418 request.url = GURL(net::URLRequestSlowDownloadJob::kKnownSizeUrl); |
414 request.method = "GET"; | 419 request.method = "GET"; |
415 request.resource_type = RESOURCE_TYPE_XHR; | 420 request.resource_type = RESOURCE_TYPE_XHR; |
416 request.download_to_file = true; | 421 request.download_to_file = true; |
417 request.request_initiator = url::Origin(); | 422 request.request_initiator = url::Origin(); |
418 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), kRoutingId, | 423 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), kRoutingId, |
419 kRequestId, request, | 424 kRequestId, 0, request, |
420 client.CreateInterfacePtr()); | 425 client.CreateInterfacePtr()); |
421 ASSERT_FALSE(client.has_received_response()); | 426 ASSERT_FALSE(client.has_received_response()); |
422 ASSERT_FALSE(client.has_data_downloaded()); | 427 ASSERT_FALSE(client.has_data_downloaded()); |
423 ASSERT_FALSE(client.has_received_completion()); | 428 ASSERT_FALSE(client.has_received_completion()); |
424 | 429 |
425 client.RunUntilResponseReceived(); | 430 client.RunUntilResponseReceived(); |
426 | 431 |
427 net::URLRequest* url_request = | 432 net::URLRequest* url_request = |
428 rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId)); | 433 rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId)); |
429 ASSERT_TRUE(url_request); | 434 ASSERT_TRUE(url_request); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 request.url = net::URLRequestMockHTTPJob::GetMockUrl("gzip-content.svgz"); | 477 request.url = net::URLRequestMockHTTPJob::GetMockUrl("gzip-content.svgz"); |
473 request.method = "GET"; | 478 request.method = "GET"; |
474 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 479 // |resource_type| can't be a frame type. It is because when PlzNavigate is |
475 // enabled, the url scheme of frame type requests from the renderer process | 480 // enabled, the url scheme of frame type requests from the renderer process |
476 // must be blob scheme. | 481 // must be blob scheme. |
477 request.resource_type = RESOURCE_TYPE_XHR; | 482 request.resource_type = RESOURCE_TYPE_XHR; |
478 // Need to set |request_initiator| for non main frame type request. | 483 // Need to set |request_initiator| for non main frame type request. |
479 request.request_initiator = url::Origin(); | 484 request.request_initiator = url::Origin(); |
480 request.report_raw_headers = true; | 485 request.report_raw_headers = true; |
481 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), kRoutingId, | 486 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), kRoutingId, |
482 kRequestId, request, | 487 kRequestId, mojom::kURLLoadOptionNone, request, |
483 client.CreateInterfacePtr()); | 488 client.CreateInterfacePtr()); |
484 | 489 |
485 client.RunUntilComplete(); | 490 client.RunUntilComplete(); |
486 | 491 |
487 std::string contents; | 492 std::string contents; |
488 while (true) { | 493 while (true) { |
489 char buffer[16]; | 494 char buffer[16]; |
490 uint32_t read_size = sizeof(buffer); | 495 uint32_t read_size = sizeof(buffer); |
491 MojoResult r = mojo::ReadDataRaw(client.response_body(), buffer, &read_size, | 496 MojoResult r = mojo::ReadDataRaw(client.response_body(), buffer, &read_size, |
492 MOJO_READ_DATA_FLAG_NONE); | 497 MOJO_READ_DATA_FLAG_NONE); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 request.url = net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_IO_PENDING); | 537 request.url = net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_IO_PENDING); |
533 request.method = "GET"; | 538 request.method = "GET"; |
534 request.is_main_frame = true; | 539 request.is_main_frame = true; |
535 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 540 // |resource_type| can't be a frame type. It is because when PlzNavigate is |
536 // enabled, the url scheme of frame type requests from the renderer process | 541 // enabled, the url scheme of frame type requests from the renderer process |
537 // must be blob scheme. | 542 // must be blob scheme. |
538 request.resource_type = RESOURCE_TYPE_XHR; | 543 request.resource_type = RESOURCE_TYPE_XHR; |
539 // Need to set |request_initiator| for non main frame type request. | 544 // Need to set |request_initiator| for non main frame type request. |
540 request.request_initiator = url::Origin(); | 545 request.request_initiator = url::Origin(); |
541 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), kRoutingId, | 546 factory_->CreateLoaderAndStart(mojo::MakeRequest(&loader), kRoutingId, |
542 kRequestId, request, | 547 kRequestId, mojom::kURLLoadOptionNone, request, |
543 client.CreateInterfacePtr()); | 548 client.CreateInterfacePtr()); |
544 | 549 |
545 base::RunLoop().RunUntilIdle(); | 550 base::RunLoop().RunUntilIdle(); |
546 ASSERT_TRUE(rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId))); | 551 ASSERT_TRUE(rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId))); |
547 ASSERT_FALSE(client.has_received_response()); | 552 ASSERT_FALSE(client.has_received_response()); |
548 ASSERT_FALSE(client.response_body().is_valid()); | 553 ASSERT_FALSE(client.response_body().is_valid()); |
549 ASSERT_FALSE(client.has_received_completion()); | 554 ASSERT_FALSE(client.has_received_completion()); |
550 | 555 |
551 loader = nullptr; | 556 loader = nullptr; |
552 base::RunLoop().RunUntilIdle(); | 557 base::RunLoop().RunUntilIdle(); |
553 ASSERT_FALSE(rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId))); | 558 ASSERT_FALSE(rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId))); |
554 } | 559 } |
555 | 560 |
556 INSTANTIATE_TEST_CASE_P(URLLoaderFactoryImplTest, | 561 INSTANTIATE_TEST_CASE_P(URLLoaderFactoryImplTest, |
557 URLLoaderFactoryImplTest, | 562 URLLoaderFactoryImplTest, |
558 ::testing::Values(128, 32 * 1024)); | 563 ::testing::Values(128, 32 * 1024)); |
559 | 564 |
560 } // namespace | 565 } // namespace |
561 | 566 |
562 } // namespace content | 567 } // namespace content |
OLD | NEW |