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

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

Issue 1376473003: Notify NQE of TCP RTT values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed net tests compilation issues, Added tests Created 4 years, 10 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 "chrome/test/chromedriver/net/websocket.h" 5 #include "chrome/test/chromedriver/net/websocket.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 #include <vector> 10 #include <vector>
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 net::IPAddressNumber address; 78 net::IPAddressNumber address;
79 if (!net::ParseIPLiteralToNumber(url_.HostNoBrackets(), &address)) { 79 if (!net::ParseIPLiteralToNumber(url_.HostNoBrackets(), &address)) {
80 if (!ResolveHost(url_.HostNoBrackets(), &address)) { 80 if (!ResolveHost(url_.HostNoBrackets(), &address)) {
81 callback.Run(net::ERR_ADDRESS_UNREACHABLE); 81 callback.Run(net::ERR_ADDRESS_UNREACHABLE);
82 return; 82 return;
83 } 83 }
84 } 84 }
85 net::AddressList addresses( 85 net::AddressList addresses(
86 net::IPEndPoint(address, static_cast<uint16_t>(url_.EffectiveIntPort()))); 86 net::IPEndPoint(address, static_cast<uint16_t>(url_.EffectiveIntPort())));
87 net::NetLog::Source source; 87 net::NetLog::Source source;
88 socket_.reset(new net::TCPClientSocket(addresses, NULL, source)); 88 socket_.reset(new net::TCPClientSocket(addresses, NULL, NULL, source));
89 89
90 state_ = CONNECTING; 90 state_ = CONNECTING;
91 connect_callback_ = callback; 91 connect_callback_ = callback;
92 int code = socket_->Connect(base::Bind( 92 int code = socket_->Connect(base::Bind(
93 &WebSocket::OnSocketConnect, base::Unretained(this))); 93 &WebSocket::OnSocketConnect, base::Unretained(this)));
94 if (code != net::ERR_IO_PENDING) 94 if (code != net::ERR_IO_PENDING)
95 OnSocketConnect(code); 95 OnSocketConnect(code);
96 } 96 }
97 97
98 bool WebSocket::Send(const std::string& message) { 98 bool WebSocket::Send(const std::string& message) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 void WebSocket::Close(int code) { 259 void WebSocket::Close(int code) {
260 socket_->Disconnect(); 260 socket_->Disconnect();
261 if (!connect_callback_.is_null()) 261 if (!connect_callback_.is_null())
262 InvokeConnectCallback(code); 262 InvokeConnectCallback(code);
263 if (state_ == OPEN) 263 if (state_ == OPEN)
264 listener_->OnClose(); 264 listener_->OnClose();
265 265
266 state_ = CLOSED; 266 state_ = CLOSED;
267 } 267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698