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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 ChildProcessSecurityPolicyImpl::GetInstance()->Add(kChildId); | 95 ChildProcessSecurityPolicyImpl::GetInstance()->Add(kChildId); |
96 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadRawCookies( | 96 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadRawCookies( |
97 kChildId); | 97 kChildId); |
98 | 98 |
99 resource_message_filter_->InitializeForTest(); | 99 resource_message_filter_->InitializeForTest(); |
100 MojoAsyncResourceHandler::SetAllocationSizeForTesting(GetParam()); | 100 MojoAsyncResourceHandler::SetAllocationSizeForTesting(GetParam()); |
101 rdh_.SetLoaderDelegate(&loader_deleate_); | 101 rdh_.SetLoaderDelegate(&loader_deleate_); |
102 | 102 |
103 URLLoaderFactoryImpl::Create( | 103 URLLoaderFactoryImpl::Create( |
104 resource_message_filter_->requester_info_for_test(), | 104 resource_message_filter_->requester_info_for_test(), |
105 mojo::GetProxy(&factory_)); | 105 mojo::MakeRequest(&factory_)); |
106 | 106 |
107 // Calling this function creates a request context. | 107 // Calling this function creates a request context. |
108 browser_context_->GetResourceContext()->GetRequestContext(); | 108 browser_context_->GetResourceContext()->GetRequestContext(); |
109 base::RunLoop().RunUntilIdle(); | 109 base::RunLoop().RunUntilIdle(); |
110 } | 110 } |
111 | 111 |
112 ~URLLoaderFactoryImplTest() override { | 112 ~URLLoaderFactoryImplTest() override { |
113 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(kChildId); | 113 ChildProcessSecurityPolicyImpl::GetInstance()->Remove(kChildId); |
114 rdh_.SetDelegate(nullptr); | 114 rdh_.SetDelegate(nullptr); |
115 net::URLRequestFilter::GetInstance()->ClearHandlers(); | 115 net::URLRequestFilter::GetInstance()->ClearHandlers(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Assume the file contents is small enough to be stored in the data pipe. | 153 // Assume the file contents is small enough to be stored in the data pipe. |
154 request.url = net::URLRequestMockHTTPJob::GetMockUrl("hello.html"); | 154 request.url = net::URLRequestMockHTTPJob::GetMockUrl("hello.html"); |
155 request.method = "GET"; | 155 request.method = "GET"; |
156 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 156 // |resource_type| can't be a frame type. It is because when PlzNavigate is |
157 // enabled, the url scheme of frame type requests from the renderer process | 157 // enabled, the url scheme of frame type requests from the renderer process |
158 // must be blob scheme. | 158 // must be blob scheme. |
159 request.resource_type = RESOURCE_TYPE_XHR; | 159 request.resource_type = RESOURCE_TYPE_XHR; |
160 // Need to set |request_initiator| for non main frame type request. | 160 // Need to set |request_initiator| for non main frame type request. |
161 request.request_initiator = url::Origin(); | 161 request.request_initiator = url::Origin(); |
162 factory_->CreateLoaderAndStart( | 162 factory_->CreateLoaderAndStart( |
163 mojo::GetProxy(&loader, factory_.associated_group()), kRoutingId, | 163 mojo::MakeRequest(&loader, factory_.associated_group()), kRoutingId, |
164 kRequestId, request, | 164 kRequestId, request, |
165 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); | 165 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); |
166 | 166 |
167 ASSERT_FALSE(client.has_received_response()); | 167 ASSERT_FALSE(client.has_received_response()); |
168 ASSERT_FALSE(client.response_body().is_valid()); | 168 ASSERT_FALSE(client.response_body().is_valid()); |
169 ASSERT_FALSE(client.has_received_completion()); | 169 ASSERT_FALSE(client.has_received_completion()); |
170 | 170 |
171 client.RunUntilResponseReceived(); | 171 client.RunUntilResponseReceived(); |
172 | 172 |
173 net::URLRequest* url_request = | 173 net::URLRequest* url_request = |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 request.url = net::URLRequestFailedJob::GetMockHttpUrlWithFailurePhase( | 232 request.url = net::URLRequestFailedJob::GetMockHttpUrlWithFailurePhase( |
233 net::URLRequestFailedJob::START, net::ERR_TIMED_OUT); | 233 net::URLRequestFailedJob::START, net::ERR_TIMED_OUT); |
234 request.method = "GET"; | 234 request.method = "GET"; |
235 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 235 // |resource_type| can't be a frame type. It is because when PlzNavigate is |
236 // enabled, the url scheme of frame type requests from the renderer process | 236 // enabled, the url scheme of frame type requests from the renderer process |
237 // must be blob scheme. | 237 // must be blob scheme. |
238 request.resource_type = RESOURCE_TYPE_XHR; | 238 request.resource_type = RESOURCE_TYPE_XHR; |
239 // Need to set |request_initiator| for non main frame type request. | 239 // Need to set |request_initiator| for non main frame type request. |
240 request.request_initiator = url::Origin(); | 240 request.request_initiator = url::Origin(); |
241 factory_->CreateLoaderAndStart( | 241 factory_->CreateLoaderAndStart( |
242 mojo::GetProxy(&loader, factory_.associated_group()), 2, 1, request, | 242 mojo::MakeRequest(&loader, factory_.associated_group()), 2, 1, request, |
243 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); | 243 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); |
244 | 244 |
245 client.RunUntilComplete(); | 245 client.RunUntilComplete(); |
246 ASSERT_FALSE(client.has_received_response()); | 246 ASSERT_FALSE(client.has_received_response()); |
247 ASSERT_FALSE(client.response_body().is_valid()); | 247 ASSERT_FALSE(client.response_body().is_valid()); |
248 | 248 |
249 EXPECT_EQ(net::ERR_TIMED_OUT, client.completion_status().error_code); | 249 EXPECT_EQ(net::ERR_TIMED_OUT, client.completion_status().error_code); |
250 EXPECT_EQ(0, client.completion_status().encoded_data_length); | 250 EXPECT_EQ(0, client.completion_status().encoded_data_length); |
251 EXPECT_EQ(0, client.completion_status().encoded_body_length); | 251 EXPECT_EQ(0, client.completion_status().encoded_body_length); |
252 } | 252 } |
253 | 253 |
254 // In this case, the loading fails after receiving a response. | 254 // In this case, the loading fails after receiving a response. |
255 TEST_P(URLLoaderFactoryImplTest, GetFailedResponse2) { | 255 TEST_P(URLLoaderFactoryImplTest, GetFailedResponse2) { |
256 NavigationResourceThrottle::set_ui_checks_always_succeed_for_testing(true); | 256 NavigationResourceThrottle::set_ui_checks_always_succeed_for_testing(true); |
257 mojom::URLLoaderAssociatedPtr loader; | 257 mojom::URLLoaderAssociatedPtr loader; |
258 ResourceRequest request; | 258 ResourceRequest request; |
259 TestURLLoaderClient client; | 259 TestURLLoaderClient client; |
260 net::URLRequestFailedJob::AddUrlHandler(); | 260 net::URLRequestFailedJob::AddUrlHandler(); |
261 request.url = net::URLRequestFailedJob::GetMockHttpUrlWithFailurePhase( | 261 request.url = net::URLRequestFailedJob::GetMockHttpUrlWithFailurePhase( |
262 net::URLRequestFailedJob::READ_ASYNC, net::ERR_TIMED_OUT); | 262 net::URLRequestFailedJob::READ_ASYNC, net::ERR_TIMED_OUT); |
263 request.method = "GET"; | 263 request.method = "GET"; |
264 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 264 // |resource_type| can't be a frame type. It is because when PlzNavigate is |
265 // enabled, the url scheme of frame type requests from the renderer process | 265 // enabled, the url scheme of frame type requests from the renderer process |
266 // must be blob scheme. | 266 // must be blob scheme. |
267 request.resource_type = RESOURCE_TYPE_XHR; | 267 request.resource_type = RESOURCE_TYPE_XHR; |
268 // Need to set |request_initiator| for non main frame type request. | 268 // Need to set |request_initiator| for non main frame type request. |
269 request.request_initiator = url::Origin(); | 269 request.request_initiator = url::Origin(); |
270 factory_->CreateLoaderAndStart( | 270 factory_->CreateLoaderAndStart( |
271 mojo::GetProxy(&loader, factory_.associated_group()), 2, 1, request, | 271 mojo::MakeRequest(&loader, factory_.associated_group()), 2, 1, request, |
272 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); | 272 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); |
273 | 273 |
274 client.RunUntilComplete(); | 274 client.RunUntilComplete(); |
275 ASSERT_FALSE(client.has_received_response()); | 275 ASSERT_FALSE(client.has_received_response()); |
276 ASSERT_TRUE(client.response_body().is_valid()); | 276 ASSERT_TRUE(client.response_body().is_valid()); |
277 | 277 |
278 EXPECT_EQ(net::ERR_TIMED_OUT, client.completion_status().error_code); | 278 EXPECT_EQ(net::ERR_TIMED_OUT, client.completion_status().error_code); |
279 EXPECT_GT(client.completion_status().encoded_data_length, 0); | 279 EXPECT_GT(client.completion_status().encoded_data_length, 0); |
280 EXPECT_EQ(0, client.completion_status().encoded_body_length); | 280 EXPECT_EQ(0, client.completion_status().encoded_body_length); |
281 } | 281 } |
282 | 282 |
283 // This test tests a case where resource loading is cancelled before started. | 283 // This test tests a case where resource loading is cancelled before started. |
284 TEST_P(URLLoaderFactoryImplTest, InvalidURL) { | 284 TEST_P(URLLoaderFactoryImplTest, InvalidURL) { |
285 mojom::URLLoaderAssociatedPtr loader; | 285 mojom::URLLoaderAssociatedPtr loader; |
286 ResourceRequest request; | 286 ResourceRequest request; |
287 TestURLLoaderClient client; | 287 TestURLLoaderClient client; |
288 request.url = GURL(); | 288 request.url = GURL(); |
289 request.method = "GET"; | 289 request.method = "GET"; |
290 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 290 // |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 | 291 // enabled, the url scheme of frame type requests from the renderer process |
292 // must be blob scheme. | 292 // must be blob scheme. |
293 request.resource_type = RESOURCE_TYPE_XHR; | 293 request.resource_type = RESOURCE_TYPE_XHR; |
294 // Need to set |request_initiator| for non main frame type request. | 294 // Need to set |request_initiator| for non main frame type request. |
295 request.request_initiator = url::Origin(); | 295 request.request_initiator = url::Origin(); |
296 ASSERT_FALSE(request.url.is_valid()); | 296 ASSERT_FALSE(request.url.is_valid()); |
297 factory_->CreateLoaderAndStart( | 297 factory_->CreateLoaderAndStart( |
298 mojo::GetProxy(&loader, factory_.associated_group()), 2, 1, request, | 298 mojo::MakeRequest(&loader, factory_.associated_group()), 2, 1, request, |
299 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); | 299 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); |
300 | 300 |
301 client.RunUntilComplete(); | 301 client.RunUntilComplete(); |
302 ASSERT_FALSE(client.has_received_response()); | 302 ASSERT_FALSE(client.has_received_response()); |
303 ASSERT_FALSE(client.response_body().is_valid()); | 303 ASSERT_FALSE(client.response_body().is_valid()); |
304 | 304 |
305 EXPECT_EQ(net::ERR_ABORTED, client.completion_status().error_code); | 305 EXPECT_EQ(net::ERR_ABORTED, client.completion_status().error_code); |
306 } | 306 } |
307 | 307 |
308 // This test tests a case where resource loading is cancelled before started. | 308 // This test tests a case where resource loading is cancelled before started. |
309 TEST_P(URLLoaderFactoryImplTest, ShouldNotRequestURL) { | 309 TEST_P(URLLoaderFactoryImplTest, ShouldNotRequestURL) { |
310 mojom::URLLoaderAssociatedPtr loader; | 310 mojom::URLLoaderAssociatedPtr loader; |
311 RejectingResourceDispatcherHostDelegate rdh_delegate; | 311 RejectingResourceDispatcherHostDelegate rdh_delegate; |
312 rdh_.SetDelegate(&rdh_delegate); | 312 rdh_.SetDelegate(&rdh_delegate); |
313 ResourceRequest request; | 313 ResourceRequest request; |
314 TestURLLoaderClient client; | 314 TestURLLoaderClient client; |
315 request.url = GURL("http://localhost/"); | 315 request.url = GURL("http://localhost/"); |
316 request.method = "GET"; | 316 request.method = "GET"; |
317 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 317 // |resource_type| can't be a frame type. It is because when PlzNavigate is |
318 // enabled, the url scheme of frame type requests from the renderer process | 318 // enabled, the url scheme of frame type requests from the renderer process |
319 // must be blob scheme. | 319 // must be blob scheme. |
320 request.resource_type = RESOURCE_TYPE_XHR; | 320 request.resource_type = RESOURCE_TYPE_XHR; |
321 // Need to set |request_initiator| for non main frame type request. | 321 // Need to set |request_initiator| for non main frame type request. |
322 request.request_initiator = url::Origin(); | 322 request.request_initiator = url::Origin(); |
323 factory_->CreateLoaderAndStart( | 323 factory_->CreateLoaderAndStart( |
324 mojo::GetProxy(&loader, factory_.associated_group()), 2, 1, request, | 324 mojo::MakeRequest(&loader, factory_.associated_group()), 2, 1, request, |
325 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); | 325 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); |
326 | 326 |
327 client.RunUntilComplete(); | 327 client.RunUntilComplete(); |
328 rdh_.SetDelegate(nullptr); | 328 rdh_.SetDelegate(nullptr); |
329 | 329 |
330 ASSERT_FALSE(client.has_received_response()); | 330 ASSERT_FALSE(client.has_received_response()); |
331 ASSERT_FALSE(client.response_body().is_valid()); | 331 ASSERT_FALSE(client.response_body().is_valid()); |
332 | 332 |
333 EXPECT_EQ(net::ERR_ABORTED, client.completion_status().error_code); | 333 EXPECT_EQ(net::ERR_ABORTED, client.completion_status().error_code); |
334 } | 334 } |
335 | 335 |
336 TEST_P(URLLoaderFactoryImplTest, DownloadToFile) { | 336 TEST_P(URLLoaderFactoryImplTest, DownloadToFile) { |
337 constexpr int32_t kRoutingId = 1; | 337 constexpr int32_t kRoutingId = 1; |
338 constexpr int32_t kRequestId = 2; | 338 constexpr int32_t kRequestId = 2; |
339 | 339 |
340 mojom::URLLoaderAssociatedPtr loader; | 340 mojom::URLLoaderAssociatedPtr loader; |
341 base::FilePath root; | 341 base::FilePath root; |
342 PathService::Get(DIR_TEST_DATA, &root); | 342 PathService::Get(DIR_TEST_DATA, &root); |
343 net::URLRequestMockHTTPJob::AddUrlHandlers(root, | 343 net::URLRequestMockHTTPJob::AddUrlHandlers(root, |
344 BrowserThread::GetBlockingPool()); | 344 BrowserThread::GetBlockingPool()); |
345 | 345 |
346 ResourceRequest request; | 346 ResourceRequest request; |
347 TestURLLoaderClient client; | 347 TestURLLoaderClient client; |
348 request.url = net::URLRequestMockHTTPJob::GetMockUrl("hello.html"); | 348 request.url = net::URLRequestMockHTTPJob::GetMockUrl("hello.html"); |
349 request.method = "GET"; | 349 request.method = "GET"; |
350 request.resource_type = RESOURCE_TYPE_XHR; | 350 request.resource_type = RESOURCE_TYPE_XHR; |
351 request.download_to_file = true; | 351 request.download_to_file = true; |
352 request.request_initiator = url::Origin(); | 352 request.request_initiator = url::Origin(); |
353 factory_->CreateLoaderAndStart( | 353 factory_->CreateLoaderAndStart( |
354 mojo::GetProxy(&loader, factory_.associated_group()), kRoutingId, | 354 mojo::MakeRequest(&loader, factory_.associated_group()), kRoutingId, |
355 kRequestId, request, | 355 kRequestId, request, |
356 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); | 356 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); |
357 ASSERT_FALSE(client.has_received_response()); | 357 ASSERT_FALSE(client.has_received_response()); |
358 ASSERT_FALSE(client.has_data_downloaded()); | 358 ASSERT_FALSE(client.has_data_downloaded()); |
359 ASSERT_FALSE(client.has_received_completion()); | 359 ASSERT_FALSE(client.has_received_completion()); |
360 | 360 |
361 client.RunUntilResponseReceived(); | 361 client.RunUntilResponseReceived(); |
362 | 362 |
363 net::URLRequest* url_request = | 363 net::URLRequest* url_request = |
364 rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId)); | 364 rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId)); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 net::URLRequestSlowDownloadJob::AddUrlHandler(); | 412 net::URLRequestSlowDownloadJob::AddUrlHandler(); |
413 | 413 |
414 ResourceRequest request; | 414 ResourceRequest request; |
415 TestURLLoaderClient client; | 415 TestURLLoaderClient client; |
416 request.url = GURL(net::URLRequestSlowDownloadJob::kKnownSizeUrl); | 416 request.url = GURL(net::URLRequestSlowDownloadJob::kKnownSizeUrl); |
417 request.method = "GET"; | 417 request.method = "GET"; |
418 request.resource_type = RESOURCE_TYPE_XHR; | 418 request.resource_type = RESOURCE_TYPE_XHR; |
419 request.download_to_file = true; | 419 request.download_to_file = true; |
420 request.request_initiator = url::Origin(); | 420 request.request_initiator = url::Origin(); |
421 factory_->CreateLoaderAndStart( | 421 factory_->CreateLoaderAndStart( |
422 mojo::GetProxy(&loader, factory_.associated_group()), kRoutingId, | 422 mojo::MakeRequest(&loader, factory_.associated_group()), kRoutingId, |
423 kRequestId, request, | 423 kRequestId, request, |
424 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); | 424 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); |
425 ASSERT_FALSE(client.has_received_response()); | 425 ASSERT_FALSE(client.has_received_response()); |
426 ASSERT_FALSE(client.has_data_downloaded()); | 426 ASSERT_FALSE(client.has_data_downloaded()); |
427 ASSERT_FALSE(client.has_received_completion()); | 427 ASSERT_FALSE(client.has_received_completion()); |
428 | 428 |
429 client.RunUntilResponseReceived(); | 429 client.RunUntilResponseReceived(); |
430 | 430 |
431 net::URLRequest* url_request = | 431 net::URLRequest* url_request = |
432 rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId)); | 432 rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 request.url = net::URLRequestMockHTTPJob::GetMockUrl("gzip-content.svgz"); | 476 request.url = net::URLRequestMockHTTPJob::GetMockUrl("gzip-content.svgz"); |
477 request.method = "GET"; | 477 request.method = "GET"; |
478 // |resource_type| can't be a frame type. It is because when PlzNavigate is | 478 // |resource_type| can't be a frame type. It is because when PlzNavigate is |
479 // enabled, the url scheme of frame type requests from the renderer process | 479 // enabled, the url scheme of frame type requests from the renderer process |
480 // must be blob scheme. | 480 // must be blob scheme. |
481 request.resource_type = RESOURCE_TYPE_XHR; | 481 request.resource_type = RESOURCE_TYPE_XHR; |
482 // Need to set |request_initiator| for non main frame type request. | 482 // Need to set |request_initiator| for non main frame type request. |
483 request.request_initiator = url::Origin(); | 483 request.request_initiator = url::Origin(); |
484 request.report_raw_headers = true; | 484 request.report_raw_headers = true; |
485 factory_->CreateLoaderAndStart( | 485 factory_->CreateLoaderAndStart( |
486 mojo::GetProxy(&loader, factory_.associated_group()), kRoutingId, | 486 mojo::MakeRequest(&loader, factory_.associated_group()), kRoutingId, |
487 kRequestId, request, | 487 kRequestId, request, |
488 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); | 488 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); |
489 | 489 |
490 client.RunUntilComplete(); | 490 client.RunUntilComplete(); |
491 | 491 |
492 std::string contents; | 492 std::string contents; |
493 while (true) { | 493 while (true) { |
494 char buffer[16]; | 494 char buffer[16]; |
495 uint32_t read_size = sizeof(buffer); | 495 uint32_t read_size = sizeof(buffer); |
496 MojoResult r = mojo::ReadDataRaw(client.response_body(), buffer, &read_size, | 496 MojoResult r = mojo::ReadDataRaw(client.response_body(), buffer, &read_size, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 request.url = net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_IO_PENDING); | 537 request.url = net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_IO_PENDING); |
538 request.method = "GET"; | 538 request.method = "GET"; |
539 request.is_main_frame = true; | 539 request.is_main_frame = true; |
540 // |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 |
541 // 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 |
542 // must be blob scheme. | 542 // must be blob scheme. |
543 request.resource_type = RESOURCE_TYPE_XHR; | 543 request.resource_type = RESOURCE_TYPE_XHR; |
544 // Need to set |request_initiator| for non main frame type request. | 544 // Need to set |request_initiator| for non main frame type request. |
545 request.request_initiator = url::Origin(); | 545 request.request_initiator = url::Origin(); |
546 factory_->CreateLoaderAndStart( | 546 factory_->CreateLoaderAndStart( |
547 mojo::GetProxy(&loader, factory_.associated_group()), kRoutingId, | 547 mojo::MakeRequest(&loader, factory_.associated_group()), kRoutingId, |
548 kRequestId, request, | 548 kRequestId, request, |
549 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); | 549 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); |
550 | 550 |
551 base::RunLoop().RunUntilIdle(); | 551 base::RunLoop().RunUntilIdle(); |
552 ASSERT_TRUE(rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId))); | 552 ASSERT_TRUE(rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId))); |
553 ASSERT_FALSE(client.has_received_response()); | 553 ASSERT_FALSE(client.has_received_response()); |
554 ASSERT_FALSE(client.response_body().is_valid()); | 554 ASSERT_FALSE(client.response_body().is_valid()); |
555 ASSERT_FALSE(client.has_received_completion()); | 555 ASSERT_FALSE(client.has_received_completion()); |
556 | 556 |
557 loader = nullptr; | 557 loader = nullptr; |
558 base::RunLoop().RunUntilIdle(); | 558 base::RunLoop().RunUntilIdle(); |
559 ASSERT_FALSE(rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId))); | 559 ASSERT_FALSE(rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId))); |
560 } | 560 } |
561 | 561 |
562 INSTANTIATE_TEST_CASE_P(URLLoaderFactoryImplTest, | 562 INSTANTIATE_TEST_CASE_P(URLLoaderFactoryImplTest, |
563 URLLoaderFactoryImplTest, | 563 URLLoaderFactoryImplTest, |
564 ::testing::Values(128, 32 * 1024)); | 564 ::testing::Values(128, 32 * 1024)); |
565 | 565 |
566 } // namespace | 566 } // namespace |
567 | 567 |
568 } // namespace content | 568 } // namespace content |
OLD | NEW |