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

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: Fix 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
« no previous file with comments | « net/http/http_stream_parser_unittest.cc ('k') | net/quic/quic_http_stream_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <vector>
6
5 #include "base/basictypes.h" 7 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
7 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
8 #include "base/stl_util.h" 10 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
10 #include "net/base/elements_upload_data_stream.h" 12 #include "net/base/elements_upload_data_stream.h"
11 #include "net/base/test_completion_callback.h" 13 #include "net/base/test_completion_callback.h"
12 #include "net/base/test_data_directory.h" 14 #include "net/base/test_data_directory.h"
13 #include "net/base/upload_bytes_element_reader.h" 15 #include "net/base/upload_bytes_element_reader.h"
14 #include "net/base/upload_data_stream.h" 16 #include "net/base/upload_data_stream.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 request_body_.clear(); 191 request_body_.clear();
190 request_body_.reserve(length); 192 request_body_.reserve(length);
191 for (size_t i = 0; i < length; ++i) { 193 for (size_t i = 0; i < length; ++i) {
192 request_body_.append(1, static_cast<char>(32 + i % (126 - 32))); 194 request_body_.append(1, static_cast<char>(32 + i % (126 - 32)));
193 } 195 }
194 } 196 }
195 197
196 // Initializes |request_| for a post of |length| bytes. 198 // Initializes |request_| for a post of |length| bytes.
197 void InitializePostRequest(size_t length) { 199 void InitializePostRequest(size_t length) {
198 GenerateBody(length); 200 GenerateBody(length);
199 ScopedVector<UploadElementReader> element_readers; 201 std::vector<scoped_ptr<UploadElementReader>> element_readers;
200 element_readers.push_back( 202 element_readers.push_back(make_scoped_ptr(new UploadBytesElementReader(
201 new UploadBytesElementReader(request_body_.data(), 203 request_body_.data(), request_body_.length())));
202 request_body_.length()));
203 upload_data_stream_.reset( 204 upload_data_stream_.reset(
204 new ElementsUploadDataStream(element_readers.Pass(), 0)); 205 new ElementsUploadDataStream(std::move(element_readers), 0));
205 request_.method = "POST"; 206 request_.method = "POST";
206 request_.url = GURL("https://test.example.com/"); 207 request_.url = GURL("https://test.example.com/");
207 request_.upload_data_stream = upload_data_stream_.get(); 208 request_.upload_data_stream = upload_data_stream_.get();
208 ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback())); 209 ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback()));
209 } 210 }
210 211
211 // Checks that |consumer| completed and received |status_line| and |body|. 212 // Checks that |consumer| completed and received |status_line| and |body|.
212 void CheckResponse(const TestTransactionConsumer& consumer, 213 void CheckResponse(const TestTransactionConsumer& consumer,
213 const std::string& status_line, 214 const std::string& status_line,
214 const std::string& body) { 215 const std::string& body) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 base::MessageLoop::current()->Run(); 314 base::MessageLoop::current()->Run();
314 315
315 for (size_t i = 0; i < num_requests; ++i) { 316 for (size_t i = 0; i < num_requests; ++i) {
316 CheckResponse(*consumers[i], "HTTP/1.1 200 OK", kResponseBody); 317 CheckResponse(*consumers[i], "HTTP/1.1 200 OK", kResponseBody);
317 } 318 }
318 STLDeleteElements(&consumers); 319 STLDeleteElements(&consumers);
319 } 320 }
320 321
321 } // namespace test 322 } // namespace test
322 } // namespace net 323 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_parser_unittest.cc ('k') | net/quic/quic_http_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698