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

Side by Side Diff: chrome/test/chromedriver/net/websocket_unittest.cc

Issue 1551503002: Convert Pass()→std::move() in //chrome (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
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 scoped_ptr<WebSocket> CreateWebSocket(const GURL& url, 90 scoped_ptr<WebSocket> CreateWebSocket(const GURL& url,
91 WebSocketListener* listener) { 91 WebSocketListener* listener) {
92 int error; 92 int error;
93 scoped_ptr<WebSocket> sock(new WebSocket(url, listener)); 93 scoped_ptr<WebSocket> sock(new WebSocket(url, listener));
94 base::RunLoop run_loop; 94 base::RunLoop run_loop;
95 sock->Connect(base::Bind(&OnConnectFinished, &run_loop, &error)); 95 sock->Connect(base::Bind(&OnConnectFinished, &run_loop, &error));
96 loop_.task_runner()->PostDelayedTask(FROM_HERE, run_loop.QuitClosure(), 96 loop_.task_runner()->PostDelayedTask(FROM_HERE, run_loop.QuitClosure(),
97 base::TimeDelta::FromSeconds(10)); 97 base::TimeDelta::FromSeconds(10));
98 run_loop.Run(); 98 run_loop.Run();
99 if (error == net::OK) 99 if (error == net::OK)
100 return sock.Pass(); 100 return sock;
101 return scoped_ptr<WebSocket>(); 101 return scoped_ptr<WebSocket>();
102 } 102 }
103 103
104 scoped_ptr<WebSocket> CreateConnectedWebSocket(WebSocketListener* listener) { 104 scoped_ptr<WebSocket> CreateConnectedWebSocket(WebSocketListener* listener) {
105 return CreateWebSocket(server_.web_socket_url(), listener); 105 return CreateWebSocket(server_.web_socket_url(), listener);
106 } 106 }
107 107
108 void SendReceive(const std::vector<std::string>& messages) { 108 void SendReceive(const std::vector<std::string>& messages) {
109 Listener listener(messages); 109 Listener listener(messages);
110 scoped_ptr<WebSocket> sock(CreateConnectedWebSocket(&listener)); 110 scoped_ptr<WebSocket> sock(CreateConnectedWebSocket(&listener));
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 SendReceive(messages); 193 SendReceive(messages);
194 } 194 }
195 195
196 TEST_F(WebSocketTest, SendReceiveMultiple) { 196 TEST_F(WebSocketTest, SendReceiveMultiple) {
197 std::vector<std::string> messages; 197 std::vector<std::string> messages;
198 messages.push_back("1"); 198 messages.push_back("1");
199 messages.push_back("2"); 199 messages.push_back("2");
200 messages.push_back("3"); 200 messages.push_back("3");
201 SendReceive(messages); 201 SendReceive(messages);
202 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698