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 <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 22 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
23 #include "content/browser/loader/resource_message_filter.h" | 23 #include "content/browser/loader/resource_message_filter.h" |
24 #include "content/browser/loader/test_url_loader_client.h" | 24 #include "content/browser/loader/test_url_loader_client.h" |
25 #include "content/browser/loader_delegate_impl.h" | 25 #include "content/browser/loader_delegate_impl.h" |
26 #include "content/common/resource_request.h" | 26 #include "content/common/resource_request.h" |
27 #include "content/common/resource_request_completion_status.h" | 27 #include "content/common/resource_request_completion_status.h" |
28 #include "content/common/url_loader.mojom.h" | 28 #include "content/common/url_loader.mojom.h" |
29 #include "content/public/browser/resource_context.h" | 29 #include "content/public/browser/resource_context.h" |
30 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 30 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
31 #include "content/public/common/content_paths.h" | 31 #include "content/public/common/content_paths.h" |
| 32 #include "content/public/common/process_type.h" |
32 #include "content/public/test/test_browser_context.h" | 33 #include "content/public/test/test_browser_context.h" |
33 #include "content/public/test/test_browser_thread_bundle.h" | 34 #include "content/public/test/test_browser_thread_bundle.h" |
34 #include "mojo/public/c/system/data_pipe.h" | 35 #include "mojo/public/c/system/data_pipe.h" |
35 #include "mojo/public/c/system/types.h" | 36 #include "mojo/public/c/system/types.h" |
36 #include "mojo/public/cpp/bindings/binding.h" | 37 #include "mojo/public/cpp/bindings/binding.h" |
37 #include "mojo/public/cpp/system/data_pipe.h" | 38 #include "mojo/public/cpp/system/data_pipe.h" |
38 #include "net/base/io_buffer.h" | 39 #include "net/base/io_buffer.h" |
39 #include "net/base/net_errors.h" | 40 #include "net/base/net_errors.h" |
40 #include "net/http/http_response_headers.h" | 41 #include "net/http/http_response_headers.h" |
41 #include "net/http/http_response_info.h" | 42 #include "net/http/http_response_info.h" |
(...skipping 26 matching lines...) Expand all Loading... |
68 // The test parameter is the number of bytes allocated for the buffer in the | 69 // The test parameter is the number of bytes allocated for the buffer in the |
69 // data pipe, for testing the case where the allocated size is smaller than the | 70 // data pipe, for testing the case where the allocated size is smaller than the |
70 // size the mime sniffer *implicitly* requires. | 71 // size the mime sniffer *implicitly* requires. |
71 class URLLoaderFactoryImplTest : public ::testing::TestWithParam<size_t> { | 72 class URLLoaderFactoryImplTest : public ::testing::TestWithParam<size_t> { |
72 public: | 73 public: |
73 URLLoaderFactoryImplTest() | 74 URLLoaderFactoryImplTest() |
74 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), | 75 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), |
75 browser_context_(new TestBrowserContext()), | 76 browser_context_(new TestBrowserContext()), |
76 resource_message_filter_(new ResourceMessageFilter( | 77 resource_message_filter_(new ResourceMessageFilter( |
77 0, | 78 0, |
78 0, | 79 // If browser side navigation is enabled then |
| 80 // ResourceDispatcherHostImpl prevents main frame URL requests from |
| 81 // the renderer. Ensure that these checks don't trip us up by |
| 82 // setting the process type in ResourceMessageFilter as |
| 83 // PROCESS_TYPE_UNKNOWN. |
| 84 PROCESS_TYPE_UNKNOWN, |
79 nullptr, | 85 nullptr, |
80 nullptr, | 86 nullptr, |
81 nullptr, | 87 nullptr, |
82 nullptr, | 88 nullptr, |
83 nullptr, | 89 nullptr, |
84 base::Bind(&URLLoaderFactoryImplTest::GetContexts, | 90 base::Bind(&URLLoaderFactoryImplTest::GetContexts, |
85 base::Unretained(this)))) { | 91 base::Unretained(this)))) { |
86 MojoAsyncResourceHandler::SetAllocationSizeForTesting(GetParam()); | 92 MojoAsyncResourceHandler::SetAllocationSizeForTesting(GetParam()); |
87 rdh_.SetLoaderDelegate(&loader_deleate_); | 93 rdh_.SetLoaderDelegate(&loader_deleate_); |
88 | 94 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 EXPECT_EQ(net::ERR_ABORTED, client.completion_status().error_code); | 240 EXPECT_EQ(net::ERR_ABORTED, client.completion_status().error_code); |
235 } | 241 } |
236 | 242 |
237 INSTANTIATE_TEST_CASE_P(URLLoaderFactoryImplTest, | 243 INSTANTIATE_TEST_CASE_P(URLLoaderFactoryImplTest, |
238 URLLoaderFactoryImplTest, | 244 URLLoaderFactoryImplTest, |
239 ::testing::Values(128, 32 * 1024)); | 245 ::testing::Values(128, 32 * 1024)); |
240 | 246 |
241 } // namespace | 247 } // namespace |
242 | 248 |
243 } // namespace content | 249 } // namespace content |
OLD | NEW |