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

Side by Side Diff: net/http/http_stream_parser_unittest.cc

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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.cc ('k') | net/http/http_transaction_test_util.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/http/http_stream_parser.h" 5 #include "net/http/http_stream_parser.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8
9 #include <algorithm> 8 #include <algorithm>
10 #include <string> 9 #include <string>
10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/files/scoped_temp_dir.h" 15 #include "base/files/scoped_temp_dir.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/run_loop.h" 18 #include "base/run_loop.h"
19 #include "base/strings/string_piece.h" 19 #include "base/strings/string_piece.h"
20 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
(...skipping 29 matching lines...) Expand all
50 SequencedSocketData* data) { 50 SequencedSocketData* data) {
51 data->set_connect_data(MockConnect(SYNCHRONOUS, OK)); 51 data->set_connect_data(MockConnect(SYNCHRONOUS, OK));
52 52
53 scoped_ptr<MockTCPClientSocket> socket( 53 scoped_ptr<MockTCPClientSocket> socket(
54 new MockTCPClientSocket(net::AddressList(), nullptr, data)); 54 new MockTCPClientSocket(net::AddressList(), nullptr, data));
55 55
56 TestCompletionCallback callback; 56 TestCompletionCallback callback;
57 EXPECT_EQ(OK, socket->Connect(callback.callback())); 57 EXPECT_EQ(OK, socket->Connect(callback.callback()));
58 58
59 scoped_ptr<ClientSocketHandle> socket_handle(new ClientSocketHandle); 59 scoped_ptr<ClientSocketHandle> socket_handle(new ClientSocketHandle);
60 socket_handle->SetSocket(socket.Pass()); 60 socket_handle->SetSocket(std::move(socket));
61 return socket_handle.Pass(); 61 return socket_handle;
62 } 62 }
63 63
64 // The empty payload is how the last chunk is encoded. 64 // The empty payload is how the last chunk is encoded.
65 TEST(HttpStreamParser, EncodeChunk_EmptyPayload) { 65 TEST(HttpStreamParser, EncodeChunk_EmptyPayload) {
66 char output[kOutputSize]; 66 char output[kOutputSize];
67 67
68 const base::StringPiece kPayload = ""; 68 const base::StringPiece kPayload = "";
69 const base::StringPiece kExpected = "0\r\n\r\n"; 69 const base::StringPiece kExpected = "0\r\n\r\n";
70 const int num_bytes_written = 70 const int num_bytes_written =
71 HttpStreamParser::EncodeChunk(kPayload, output, sizeof(output)); 71 HttpStreamParser::EncodeChunk(kPayload, output, sizeof(output));
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 ASSERT_EQ(kBodySize, parser.ReadResponseBody( 1282 ASSERT_EQ(kBodySize, parser.ReadResponseBody(
1283 body_buffer.get(), kBodySize, callback.callback())); 1283 body_buffer.get(), kBodySize, callback.callback()));
1284 1284
1285 EXPECT_EQ(CountWriteBytes(writes, arraysize(writes)), parser.sent_bytes()); 1285 EXPECT_EQ(CountWriteBytes(writes, arraysize(writes)), parser.sent_bytes());
1286 EXPECT_EQ(CountReadBytes(reads, arraysize(reads)), parser.received_bytes()); 1286 EXPECT_EQ(CountReadBytes(reads, arraysize(reads)), parser.received_bytes());
1287 } 1287 }
1288 1288
1289 } // namespace 1289 } // namespace
1290 1290
1291 } // namespace net 1291 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_parser.cc ('k') | net/http/http_transaction_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698