| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <memory> | 5 #include <memory> |
| 6 #include <ostream> | 6 #include <ostream> |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 void InitializePostRequest(size_t length) { | 231 void InitializePostRequest(size_t length) { |
| 232 GenerateBody(length); | 232 GenerateBody(length); |
| 233 std::vector<std::unique_ptr<UploadElementReader>> element_readers; | 233 std::vector<std::unique_ptr<UploadElementReader>> element_readers; |
| 234 element_readers.push_back(base::WrapUnique(new UploadBytesElementReader( | 234 element_readers.push_back(base::WrapUnique(new UploadBytesElementReader( |
| 235 request_body_.data(), request_body_.length()))); | 235 request_body_.data(), request_body_.length()))); |
| 236 upload_data_stream_.reset( | 236 upload_data_stream_.reset( |
| 237 new ElementsUploadDataStream(std::move(element_readers), 0)); | 237 new ElementsUploadDataStream(std::move(element_readers), 0)); |
| 238 request_.method = "POST"; | 238 request_.method = "POST"; |
| 239 request_.url = GURL("https://test.example.com/"); | 239 request_.url = GURL("https://test.example.com/"); |
| 240 request_.upload_data_stream = upload_data_stream_.get(); | 240 request_.upload_data_stream = upload_data_stream_.get(); |
| 241 ASSERT_THAT(request_.upload_data_stream->Init(CompletionCallback()), | 241 ASSERT_THAT( |
| 242 IsOk()); | 242 request_.upload_data_stream->Init(CompletionCallback(), BoundNetLog()), |
| 243 IsOk()); |
| 243 } | 244 } |
| 244 | 245 |
| 245 // Checks that |consumer| completed and received |status_line| and |body|. | 246 // Checks that |consumer| completed and received |status_line| and |body|. |
| 246 void CheckResponse(const TestTransactionConsumer& consumer, | 247 void CheckResponse(const TestTransactionConsumer& consumer, |
| 247 const std::string& status_line, | 248 const std::string& status_line, |
| 248 const std::string& body) { | 249 const std::string& body) { |
| 249 ASSERT_TRUE(consumer.is_done()); | 250 ASSERT_TRUE(consumer.is_done()); |
| 250 ASSERT_THAT(consumer.error(), IsOk()); | 251 ASSERT_THAT(consumer.error(), IsOk()); |
| 251 EXPECT_EQ(status_line, consumer.response_info()->headers->GetStatusLine()); | 252 EXPECT_EQ(status_line, consumer.response_info()->headers->GetStatusLine()); |
| 252 EXPECT_EQ(body, consumer.content()); | 253 EXPECT_EQ(body, consumer.content()); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 base::RunLoop().Run(); | 383 base::RunLoop().Run(); |
| 383 | 384 |
| 384 for (size_t i = 0; i < num_requests; ++i) { | 385 for (size_t i = 0; i < num_requests; ++i) { |
| 385 CheckResponse(*consumers[i], "HTTP/1.1 200", kResponseBody); | 386 CheckResponse(*consumers[i], "HTTP/1.1 200", kResponseBody); |
| 386 } | 387 } |
| 387 STLDeleteElements(&consumers); | 388 STLDeleteElements(&consumers); |
| 388 } | 389 } |
| 389 | 390 |
| 390 } // namespace test | 391 } // namespace test |
| 391 } // namespace net | 392 } // namespace net |
| OLD | NEW |