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

Side by Side Diff: net/websockets/websocket_handshake_stream_create_helper_test.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, 12 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
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 "net/websockets/websocket_handshake_stream_create_helper.h" 5 #include "net/websockets/websocket_handshake_stream_create_helper.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "net/base/completion_callback.h" 12 #include "net/base/completion_callback.h"
12 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
13 #include "net/http/http_request_headers.h" 14 #include "net/http/http_request_headers.h"
14 #include "net/http/http_request_info.h" 15 #include "net/http/http_request_info.h"
15 #include "net/http/http_response_headers.h" 16 #include "net/http/http_response_headers.h"
16 #include "net/http/http_response_info.h" 17 #include "net/http/http_response_info.h"
17 #include "net/socket/client_socket_handle.h" 18 #include "net/socket/client_socket_handle.h"
(...skipping 22 matching lines...) Expand all
40 const std::string& return_to_read) { 41 const std::string& return_to_read) {
41 socket_factory_maker_.SetExpectations(expect_written, return_to_read); 42 socket_factory_maker_.SetExpectations(expect_written, return_to_read);
42 scoped_ptr<ClientSocketHandle> socket_handle(new ClientSocketHandle); 43 scoped_ptr<ClientSocketHandle> socket_handle(new ClientSocketHandle);
43 socket_handle->Init( 44 socket_handle->Init(
44 "a", 45 "a",
45 scoped_refptr<MockTransportSocketParams>(), 46 scoped_refptr<MockTransportSocketParams>(),
46 MEDIUM, 47 MEDIUM,
47 CompletionCallback(), 48 CompletionCallback(),
48 &pool_, 49 &pool_,
49 BoundNetLog()); 50 BoundNetLog());
50 return socket_handle.Pass(); 51 return socket_handle;
51 } 52 }
52 53
53 private: 54 private:
54 WebSocketMockClientSocketFactoryMaker socket_factory_maker_; 55 WebSocketMockClientSocketFactoryMaker socket_factory_maker_;
55 MockTransportClientSocketPool pool_; 56 MockTransportClientSocketPool pool_;
56 57
57 DISALLOW_COPY_AND_ASSIGN(MockClientSocketHandleFactory); 58 DISALLOW_COPY_AND_ASSIGN(MockClientSocketHandleFactory);
58 }; 59 };
59 60
60 class TestConnectDelegate : public WebSocketStream::ConnectDelegate { 61 class TestConnectDelegate : public WebSocketStream::ConnectDelegate {
(...skipping 25 matching lines...) Expand all
86 create_helper.set_failure_message(&failure_message_); 87 create_helper.set_failure_message(&failure_message_);
87 88
88 scoped_ptr<ClientSocketHandle> socket_handle = 89 scoped_ptr<ClientSocketHandle> socket_handle =
89 socket_handle_factory_.CreateClientSocketHandle( 90 socket_handle_factory_.CreateClientSocketHandle(
90 WebSocketStandardRequest("/", "localhost", 91 WebSocketStandardRequest("/", "localhost",
91 url::Origin(GURL(kOrigin)), 92 url::Origin(GURL(kOrigin)),
92 extra_request_headers), 93 extra_request_headers),
93 WebSocketStandardResponse(extra_response_headers)); 94 WebSocketStandardResponse(extra_response_headers));
94 95
95 scoped_ptr<WebSocketHandshakeStreamBase> handshake( 96 scoped_ptr<WebSocketHandshakeStreamBase> handshake(
96 create_helper.CreateBasicStream(socket_handle.Pass(), false)); 97 create_helper.CreateBasicStream(std::move(socket_handle), false));
97 98
98 // If in future the implementation type returned by CreateBasicStream() 99 // If in future the implementation type returned by CreateBasicStream()
99 // changes, this static_cast will be wrong. However, in that case the test 100 // changes, this static_cast will be wrong. However, in that case the test
100 // will fail and AddressSanitizer should identify the issue. 101 // will fail and AddressSanitizer should identify the issue.
101 static_cast<WebSocketBasicHandshakeStream*>(handshake.get()) 102 static_cast<WebSocketBasicHandshakeStream*>(handshake.get())
102 ->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ=="); 103 ->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ==");
103 104
104 HttpRequestInfo request_info; 105 HttpRequestInfo request_info;
105 request_info.url = GURL("ws://localhost/"); 106 request_info.url = GURL("ws://localhost/");
106 request_info.method = "GET"; 107 request_info.method = "GET";
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 181
181 EXPECT_EQ( 182 EXPECT_EQ(
182 "permessage-deflate;" 183 "permessage-deflate;"
183 " client_max_window_bits=14; server_max_window_bits=14;" 184 " client_max_window_bits=14; server_max_window_bits=14;"
184 " server_no_context_takeover; client_no_context_takeover", 185 " server_no_context_takeover; client_no_context_takeover",
185 stream->GetExtensions()); 186 stream->GetExtensions());
186 } 187 }
187 188
188 } // namespace 189 } // namespace
189 } // namespace net 190 } // namespace net
OLDNEW
« no previous file with comments | « net/websockets/websocket_handshake_stream_create_helper.cc ('k') | net/websockets/websocket_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698