| Index: content/browser/loader/url_loader_factory_impl_unittest.cc
|
| diff --git a/content/browser/loader/url_loader_factory_impl_unittest.cc b/content/browser/loader/url_loader_factory_impl_unittest.cc
|
| index 86191fabca5c29379c78c792b167230b2664484f..387a291c037f4f85edb601b5a03816ed68fb9cec 100644
|
| --- a/content/browser/loader/url_loader_factory_impl_unittest.cc
|
| +++ b/content/browser/loader/url_loader_factory_impl_unittest.cc
|
| @@ -33,7 +33,6 @@
|
| #include "content/public/browser/resource_context.h"
|
| #include "content/public/browser/resource_dispatcher_host_delegate.h"
|
| #include "content/public/common/content_paths.h"
|
| -#include "content/public/common/process_type.h"
|
| #include "content/public/test/test_browser_context.h"
|
| #include "content/public/test/test_browser_thread_bundle.h"
|
| #include "mojo/public/c/system/data_pipe.h"
|
| @@ -83,12 +82,6 @@ class URLLoaderFactoryImplTest : public ::testing::TestWithParam<size_t> {
|
| browser_context_(new TestBrowserContext()),
|
| resource_message_filter_(new ResourceMessageFilter(
|
| kChildId,
|
| - // If browser side navigation is enabled then
|
| - // ResourceDispatcherHostImpl prevents main frame URL requests from
|
| - // the renderer. Ensure that these checks don't trip us up by
|
| - // setting the process type in ResourceMessageFilter as
|
| - // PROCESS_TYPE_UNKNOWN.
|
| - PROCESS_TYPE_UNKNOWN,
|
| nullptr,
|
| nullptr,
|
| nullptr,
|
| @@ -98,7 +91,8 @@ class URLLoaderFactoryImplTest : public ::testing::TestWithParam<size_t> {
|
| MojoAsyncResourceHandler::SetAllocationSizeForTesting(GetParam());
|
| rdh_.SetLoaderDelegate(&loader_deleate_);
|
|
|
| - URLLoaderFactoryImpl::Create(resource_message_filter_,
|
| + URLLoaderFactoryImpl::Create(ResourceRequesterInfo::CreateForRenderer(
|
| + resource_message_filter_->GetWeakPtr()),
|
| mojo::GetProxy(&factory_));
|
|
|
| // Calling this function creates a request context.
|
| @@ -148,7 +142,12 @@ TEST_P(URLLoaderFactoryImplTest, GetResponse) {
|
| // Assume the file contents is small enough to be stored in the data pipe.
|
| request.url = net::URLRequestMockHTTPJob::GetMockUrl("hello.html");
|
| request.method = "GET";
|
| - request.is_main_frame = true;
|
| + // |resource_type| can't be a frame type. It is because when PlzNavigate is
|
| + // enabled, the url scheme of frame type requests from the renderer process
|
| + // must be blob scheme.
|
| + request.resource_type = RESOURCE_TYPE_XHR;
|
| + // Need to set |request_initiator| for non main frame type request.
|
| + request.request_initiator = url::Origin(GURL("http://localhost/"));
|
| factory_->CreateLoaderAndStart(
|
| mojo::GetProxy(&loader, factory_.associated_group()), kRoutingId,
|
| kRequestId, request,
|
| @@ -213,6 +212,12 @@ TEST_P(URLLoaderFactoryImplTest, GetFailedResponse) {
|
| request.url = net::URLRequestFailedJob::GetMockHttpUrlWithFailurePhase(
|
| net::URLRequestFailedJob::START, net::ERR_TIMED_OUT);
|
| request.method = "GET";
|
| + // |resource_type| can't be a frame type. It is because when PlzNavigate is
|
| + // enabled, the url scheme of frame type requests from the renderer process
|
| + // must be blob scheme.
|
| + request.resource_type = RESOURCE_TYPE_XHR;
|
| + // Need to set |request_initiator| for non main frame type request.
|
| + request.request_initiator = url::Origin(GURL("http://localhost/"));
|
| factory_->CreateLoaderAndStart(
|
| mojo::GetProxy(&loader, factory_.associated_group()), 2, 1, request,
|
| client.CreateRemoteAssociatedPtrInfo(factory_.associated_group()));
|
| @@ -231,6 +236,12 @@ TEST_P(URLLoaderFactoryImplTest, InvalidURL) {
|
| TestURLLoaderClient client;
|
| request.url = GURL();
|
| request.method = "GET";
|
| + // |resource_type| can't be a frame type. It is because when PlzNavigate is
|
| + // enabled, the url scheme of frame type requests from the renderer process
|
| + // must be blob scheme.
|
| + request.resource_type = RESOURCE_TYPE_XHR;
|
| + // Need to set |request_initiator| for non main frame type request.
|
| + request.request_initiator = url::Origin(GURL("http://localhost/"));
|
| ASSERT_FALSE(request.url.is_valid());
|
| factory_->CreateLoaderAndStart(
|
| mojo::GetProxy(&loader, factory_.associated_group()), 2, 1, request,
|
| @@ -252,6 +263,12 @@ TEST_P(URLLoaderFactoryImplTest, ShouldNotRequestURL) {
|
| TestURLLoaderClient client;
|
| request.url = GURL("http://localhost/");
|
| request.method = "GET";
|
| + // |resource_type| can't be a frame type. It is because when PlzNavigate is
|
| + // enabled, the url scheme of frame type requests from the renderer process
|
| + // must be blob scheme.
|
| + request.resource_type = RESOURCE_TYPE_XHR;
|
| + // Need to set |request_initiator| for non main frame type request.
|
| + request.request_initiator = url::Origin(GURL("http://localhost/"));
|
| factory_->CreateLoaderAndStart(
|
| mojo::GetProxy(&loader, factory_.associated_group()), 2, 1, request,
|
| client.CreateRemoteAssociatedPtrInfo(factory_.associated_group()));
|
|
|