OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "net/url_request/url_request_simple_job.h" | 5 #include "net/url_request/url_request_simple_job.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 public: | 125 public: |
126 URLRequestSimpleJobTest() | 126 URLRequestSimpleJobTest() |
127 : worker_pool_owner_(1, "URLRequestSimpleJobTest"), | 127 : worker_pool_owner_(1, "URLRequestSimpleJobTest"), |
128 task_runner_(worker_pool_owner_.pool() | 128 task_runner_(worker_pool_owner_.pool() |
129 ->GetSequencedTaskRunnerWithShutdownBehavior( | 129 ->GetSequencedTaskRunnerWithShutdownBehavior( |
130 worker_pool_owner_.pool() | 130 worker_pool_owner_.pool() |
131 ->GetSequenceToken(), | 131 ->GetSequenceToken(), |
132 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)), | 132 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)), |
133 context_(true) { | 133 context_(true) { |
134 job_factory_.SetProtocolHandler( | 134 job_factory_.SetProtocolHandler( |
135 "data", base::WrapUnique(new SimpleJobProtocolHandler(task_runner_))); | 135 "data", base::MakeUnique<SimpleJobProtocolHandler>(task_runner_)); |
136 context_.set_job_factory(&job_factory_); | 136 context_.set_job_factory(&job_factory_); |
137 context_.Init(); | 137 context_.Init(); |
138 | 138 |
139 request_ = | 139 request_ = |
140 context_.CreateRequest(GURL("data:test"), DEFAULT_PRIORITY, &delegate_); | 140 context_.CreateRequest(GURL("data:test"), DEFAULT_PRIORITY, &delegate_); |
141 } | 141 } |
142 | 142 |
143 void StartRequest(const HttpRequestHeaders* headers) { | 143 void StartRequest(const HttpRequestHeaders* headers) { |
144 if (headers) | 144 if (headers) |
145 request_->SetExtraRequestHeaders(*headers); | 145 request_->SetExtraRequestHeaders(*headers); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 run_loop.Run(); | 245 run_loop.Run(); |
246 | 246 |
247 EXPECT_EQ(URLRequestStatus::CANCELED, request_->status().status()); | 247 EXPECT_EQ(URLRequestStatus::CANCELED, request_->status().status()); |
248 EXPECT_EQ(1, cancel_delegate.response_started_count()); | 248 EXPECT_EQ(1, cancel_delegate.response_started_count()); |
249 EXPECT_EQ("", cancel_delegate.data_received()); | 249 EXPECT_EQ("", cancel_delegate.data_received()); |
250 // Destroy the request so it doesn't outlive its delegate. | 250 // Destroy the request so it doesn't outlive its delegate. |
251 request_.reset(); | 251 request_.reset(); |
252 } | 252 } |
253 | 253 |
254 } // namespace net | 254 } // namespace net |
OLD | NEW |