| 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/mojo_async_resource_handler.h" | 5 #include "content/browser/loader/mojo_async_resource_handler.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 DISALLOW_COPY_AND_ASSIGN(TestResourceController); | 217 DISALLOW_COPY_AND_ASSIGN(TestResourceController); |
| 218 }; | 218 }; |
| 219 | 219 |
| 220 class MojoAsyncResourceHandlerWithCustomDataPipeOperations | 220 class MojoAsyncResourceHandlerWithCustomDataPipeOperations |
| 221 : public MojoAsyncResourceHandler { | 221 : public MojoAsyncResourceHandler { |
| 222 public: | 222 public: |
| 223 MojoAsyncResourceHandlerWithCustomDataPipeOperations( | 223 MojoAsyncResourceHandlerWithCustomDataPipeOperations( |
| 224 net::URLRequest* request, | 224 net::URLRequest* request, |
| 225 ResourceDispatcherHostImpl* rdh, | 225 ResourceDispatcherHostImpl* rdh, |
| 226 mojo::InterfaceRequest<mojom::URLLoader> mojo_request, | 226 mojom::URLLoaderAssociatedRequest mojo_request, |
| 227 mojom::URLLoaderClientPtr url_loader_client) | 227 mojom::URLLoaderClientAssociatedPtr url_loader_client) |
| 228 : MojoAsyncResourceHandler(request, | 228 : MojoAsyncResourceHandler(request, |
| 229 rdh, | 229 rdh, |
| 230 std::move(mojo_request), | 230 std::move(mojo_request), |
| 231 std::move(url_loader_client)) {} | 231 std::move(url_loader_client)) {} |
| 232 ~MojoAsyncResourceHandlerWithCustomDataPipeOperations() override {} | 232 ~MojoAsyncResourceHandlerWithCustomDataPipeOperations() override {} |
| 233 | 233 |
| 234 void ResetBeginWriteExpectation() { is_begin_write_expectation_set_ = false; } | 234 void ResetBeginWriteExpectation() { is_begin_write_expectation_set_ = false; } |
| 235 | 235 |
| 236 void set_begin_write_expectation(MojoResult begin_write_expectation) { | 236 void set_begin_write_expectation(MojoResult begin_write_expectation) { |
| 237 is_begin_write_expectation_set_ = true; | 237 is_begin_write_expectation_set_ = true; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 browser_context_->GetResourceContext(), // context | 283 browser_context_->GetResourceContext(), // context |
| 284 2, // render_process_id | 284 2, // render_process_id |
| 285 0, // render_view_id | 285 0, // render_view_id |
| 286 0, // render_frame_id | 286 0, // render_frame_id |
| 287 true, // is_main_frame | 287 true, // is_main_frame |
| 288 false, // parent_is_main_frame | 288 false, // parent_is_main_frame |
| 289 false, // allow_download | 289 false, // allow_download |
| 290 true, // is_async | 290 true, // is_async |
| 291 false // is_using_lofi | 291 false // is_using_lofi |
| 292 ); | 292 ); |
| 293 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info = |
| 294 url_loader_client_.CreateLocalAssociatedPtrInfo(); |
| 295 mojom::URLLoaderClientAssociatedPtr client_ptr; |
| 296 client_ptr.Bind(std::move(client_ptr_info)); |
| 293 handler_.reset(new MojoAsyncResourceHandlerWithCustomDataPipeOperations( | 297 handler_.reset(new MojoAsyncResourceHandlerWithCustomDataPipeOperations( |
| 294 request_.get(), &rdh_, nullptr, | 298 request_.get(), &rdh_, nullptr, std::move(client_ptr))); |
| 295 url_loader_client_.CreateInterfacePtrAndBind())); | |
| 296 handler_->SetController(&resource_controller_); | 299 handler_->SetController(&resource_controller_); |
| 297 } | 300 } |
| 298 | 301 |
| 299 virtual ~MojoAsyncResourceHandlerTestBase() { | 302 virtual ~MojoAsyncResourceHandlerTestBase() { |
| 300 net::URLRequestFilter::GetInstance()->ClearHandlers(); | 303 net::URLRequestFilter::GetInstance()->ClearHandlers(); |
| 301 MojoAsyncResourceHandler::SetAllocationSizeForTesting( | 304 MojoAsyncResourceHandler::SetAllocationSizeForTesting( |
| 302 MojoAsyncResourceHandler::kDefaultAllocationSize); | 305 MojoAsyncResourceHandler::kDefaultAllocationSize); |
| 303 base::RunLoop().RunUntilIdle(); | 306 base::RunLoop().RunUntilIdle(); |
| 304 } | 307 } |
| 305 | 308 |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 } | 1135 } |
| 1133 } | 1136 } |
| 1134 EXPECT_EQ("B", body); | 1137 EXPECT_EQ("B", body); |
| 1135 } | 1138 } |
| 1136 | 1139 |
| 1137 INSTANTIATE_TEST_CASE_P(MojoAsyncResourceHandlerWithAllocationSizeTest, | 1140 INSTANTIATE_TEST_CASE_P(MojoAsyncResourceHandlerWithAllocationSizeTest, |
| 1138 MojoAsyncResourceHandlerWithAllocationSizeTest, | 1141 MojoAsyncResourceHandlerWithAllocationSizeTest, |
| 1139 ::testing::Values(8, 32 * 2014)); | 1142 ::testing::Values(8, 32 * 2014)); |
| 1140 } // namespace | 1143 } // namespace |
| 1141 } // namespace content | 1144 } // namespace content |
| OLD | NEW |