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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 options.capacity_num_bytes = 1024; | 130 options.capacity_num_bytes = 1024; |
131 return options; | 131 return options; |
132 } | 132 } |
133 | 133 |
134 // Returns the request id. | 134 // Returns the request id. |
135 int SetUpRequestPeer(std::unique_ptr<ResourceRequest> request, | 135 int SetUpRequestPeer(std::unique_ptr<ResourceRequest> request, |
136 TestRequestPeer::Context* context) { | 136 TestRequestPeer::Context* context) { |
137 return dispatcher_->StartAsync( | 137 return dispatcher_->StartAsync( |
138 std::move(request), 0, nullptr, url::Origin(), | 138 std::move(request), 0, nullptr, url::Origin(), |
139 base::MakeUnique<TestRequestPeer>(context, message_loop_.task_runner()), | 139 base::MakeUnique<TestRequestPeer>(context, message_loop_.task_runner()), |
140 blink::WebURLRequest::LoadingIPCType::kChromeIPC, nullptr); | 140 blink::WebURLRequest::LoadingIPCType::kChromeIPC, nullptr, |
| 141 mojo::ScopedDataPipeConsumerHandle()); |
141 } | 142 } |
142 | 143 |
143 void Run(TestRequestPeer::Context* context) { | 144 void Run(TestRequestPeer::Context* context) { |
144 base::RunLoop run_loop; | 145 base::RunLoop run_loop; |
145 context->run_loop_quit_closure = run_loop.QuitClosure(); | 146 context->run_loop_quit_closure = run_loop.QuitClosure(); |
146 run_loop.Run(); | 147 run_loop.Run(); |
147 } | 148 } |
148 | 149 |
149 base::MessageLoop message_loop_; | 150 base::MessageLoop message_loop_; |
150 std::unique_ptr<ResourceDispatcher> dispatcher_; | 151 std::unique_ptr<ResourceDispatcher> dispatcher_; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'a'), context.data); | 301 EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'a'), context.data); |
301 context.data.clear(); | 302 context.data.clear(); |
302 | 303 |
303 Run(&context); | 304 Run(&context); |
304 EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'b'), context.data); | 305 EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'b'), context.data); |
305 } | 306 } |
306 | 307 |
307 } // namespace | 308 } // namespace |
308 | 309 |
309 } // namespace content | 310 } // namespace content |
OLD | NEW |