Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: net/quic/quic_end_to_end_unittest.cc

Issue 1476443002: Remove ScopedVector from ElementsUploadDataStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "net/base/elements_upload_data_stream.h" 10 #include "net/base/elements_upload_data_stream.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 request_body_.clear(); 189 request_body_.clear();
190 request_body_.reserve(length); 190 request_body_.reserve(length);
191 for (size_t i = 0; i < length; ++i) { 191 for (size_t i = 0; i < length; ++i) {
192 request_body_.append(1, static_cast<char>(32 + i % (126 - 32))); 192 request_body_.append(1, static_cast<char>(32 + i % (126 - 32)));
193 } 193 }
194 } 194 }
195 195
196 // Initializes |request_| for a post of |length| bytes. 196 // Initializes |request_| for a post of |length| bytes.
197 void InitializePostRequest(size_t length) { 197 void InitializePostRequest(size_t length) {
198 GenerateBody(length); 198 GenerateBody(length);
199 ScopedVector<UploadElementReader> element_readers; 199 std::vector<scoped_ptr<UploadElementReader>> element_readers;
mmenke 2015/11/24 17:25:08 include vector
200 element_readers.push_back( 200 element_readers.push_back(make_scoped_ptr(new UploadBytesElementReader(
201 new UploadBytesElementReader(request_body_.data(), 201 request_body_.data(), request_body_.length())));
202 request_body_.length()));
203 upload_data_stream_.reset( 202 upload_data_stream_.reset(
204 new ElementsUploadDataStream(element_readers.Pass(), 0)); 203 new ElementsUploadDataStream(std::move(element_readers), 0));
205 request_.method = "POST"; 204 request_.method = "POST";
206 request_.url = GURL("https://test.example.com/"); 205 request_.url = GURL("https://test.example.com/");
207 request_.upload_data_stream = upload_data_stream_.get(); 206 request_.upload_data_stream = upload_data_stream_.get();
208 ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback())); 207 ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback()));
209 } 208 }
210 209
211 // Checks that |consumer| completed and received |status_line| and |body|. 210 // Checks that |consumer| completed and received |status_line| and |body|.
212 void CheckResponse(const TestTransactionConsumer& consumer, 211 void CheckResponse(const TestTransactionConsumer& consumer,
213 const std::string& status_line, 212 const std::string& status_line,
214 const std::string& body) { 213 const std::string& body) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 base::MessageLoop::current()->Run(); 312 base::MessageLoop::current()->Run();
314 313
315 for (size_t i = 0; i < num_requests; ++i) { 314 for (size_t i = 0; i < num_requests; ++i) {
316 CheckResponse(*consumers[i], "HTTP/1.1 200 OK", kResponseBody); 315 CheckResponse(*consumers[i], "HTTP/1.1 200 OK", kResponseBody);
317 } 316 }
318 STLDeleteElements(&consumers); 317 STLDeleteElements(&consumers);
319 } 318 }
320 319
321 } // namespace test 320 } // namespace test
322 } // namespace net 321 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698