| 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/child/url_response_body_consumer.h" | 5 #include "content/child/url_response_body_consumer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 return options; | 134 return options; |
| 135 } | 135 } |
| 136 | 136 |
| 137 // Returns the request id. | 137 // Returns the request id. |
| 138 int SetUpRequestPeer(std::unique_ptr<ResourceRequest> request, | 138 int SetUpRequestPeer(std::unique_ptr<ResourceRequest> request, |
| 139 TestRequestPeer::Context* context) { | 139 TestRequestPeer::Context* context) { |
| 140 return dispatcher_->StartAsync( | 140 return dispatcher_->StartAsync( |
| 141 std::move(request), 0, nullptr, url::Origin(), | 141 std::move(request), 0, nullptr, url::Origin(), |
| 142 base::MakeUnique<TestRequestPeer>(context, message_loop_.task_runner()), | 142 base::MakeUnique<TestRequestPeer>(context, message_loop_.task_runner()), |
| 143 blink::WebURLRequest::LoadingIPCType::kChromeIPC, nullptr, | 143 blink::WebURLRequest::LoadingIPCType::kChromeIPC, nullptr, |
| 144 std::vector<std::unique_ptr<URLLoaderThrottle>>(), |
| 144 mojo::ScopedDataPipeConsumerHandle()); | 145 mojo::ScopedDataPipeConsumerHandle()); |
| 145 } | 146 } |
| 146 | 147 |
| 147 void Run(TestRequestPeer::Context* context) { | 148 void Run(TestRequestPeer::Context* context) { |
| 148 base::RunLoop run_loop; | 149 base::RunLoop run_loop; |
| 149 context->run_loop_quit_closure = run_loop.QuitClosure(); | 150 context->run_loop_quit_closure = run_loop.QuitClosure(); |
| 150 run_loop.Run(); | 151 run_loop.Run(); |
| 151 } | 152 } |
| 152 | 153 |
| 153 base::MessageLoop message_loop_; | 154 base::MessageLoop message_loop_; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'a'), context.data); | 305 EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'a'), context.data); |
| 305 context.data.clear(); | 306 context.data.clear(); |
| 306 | 307 |
| 307 Run(&context); | 308 Run(&context); |
| 308 EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'b'), context.data); | 309 EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'b'), context.data); |
| 309 } | 310 } |
| 310 | 311 |
| 311 } // namespace | 312 } // namespace |
| 312 | 313 |
| 313 } // namespace content | 314 } // namespace content |
| OLD | NEW |