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

Side by Side Diff: net/socket/stream_listen_socket.h

Issue 319593013: Added unit test for DevTools' ephemeral port support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review feedback from wtc. Made Get{Local,Peer}Address virtual. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/devtools/devtools_http_handler_unittest.cc ('k') | no next file » | 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 // Stream-based listen socket implementation that handles reading and writing 5 // Stream-based listen socket implementation that handles reading and writing
6 // to the socket, but does not handle creating the socket nor connecting 6 // to the socket, but does not handle creating the socket nor connecting
7 // sockets, which are handled by subclasses on creation and in Accept, 7 // sockets, which are handled by subclasses on creation and in Accept,
8 // respectively. 8 // respectively.
9 9
10 // StreamListenSocket handles IO asynchronously in the specified MessageLoop. 10 // StreamListenSocket handles IO asynchronously in the specified MessageLoop.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 protected: 66 protected:
67 virtual ~Delegate() {} 67 virtual ~Delegate() {}
68 }; 68 };
69 69
70 // Send data to the socket. 70 // Send data to the socket.
71 void Send(const char* bytes, int len, bool append_linefeed = false); 71 void Send(const char* bytes, int len, bool append_linefeed = false);
72 void Send(const std::string& str, bool append_linefeed = false); 72 void Send(const std::string& str, bool append_linefeed = false);
73 73
74 // Copies the local address to |address|. Returns a network error code. 74 // Copies the local address to |address|. Returns a network error code.
75 int GetLocalAddress(IPEndPoint* address); 75 // This method is virtual to support unit testing.
76 virtual int GetLocalAddress(IPEndPoint* address);
76 // Copies the peer address to |address|. Returns a network error code. 77 // Copies the peer address to |address|. Returns a network error code.
77 int GetPeerAddress(IPEndPoint* address); 78 // This method is virtual to support unit testing.
79 virtual int GetPeerAddress(IPEndPoint* address);
78 80
79 static const int kSocketError; 81 static const int kSocketError;
80 82
81 protected: 83 protected:
82 enum WaitState { 84 enum WaitState {
83 NOT_WAITING = 0, 85 NOT_WAITING = 0,
84 WAITING_ACCEPT = 1, 86 WAITING_ACCEPT = 1,
85 WAITING_READ = 2 87 WAITING_READ = 2
86 }; 88 };
87 89
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 virtual ~StreamListenSocketFactory() {} 143 virtual ~StreamListenSocketFactory() {}
142 144
143 // Returns a new instance of StreamListenSocket or NULL if an error occurred. 145 // Returns a new instance of StreamListenSocket or NULL if an error occurred.
144 virtual scoped_ptr<StreamListenSocket> CreateAndListen( 146 virtual scoped_ptr<StreamListenSocket> CreateAndListen(
145 StreamListenSocket::Delegate* delegate) const = 0; 147 StreamListenSocket::Delegate* delegate) const = 0;
146 }; 148 };
147 149
148 } // namespace net 150 } // namespace net
149 151
150 #endif // NET_SOCKET_STREAM_LISTEN_SOCKET_H_ 152 #endif // NET_SOCKET_STREAM_LISTEN_SOCKET_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools_http_handler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698