diff options
author | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-07 15:22:28 +0000 |
---|---|---|
committer | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-07 15:22:28 +0000 |
commit | ab73904ffa1b236905a4f1253dd03e02dd9e8695 (patch) | |
tree | 280c13fdd850ed27e964df6f25cc7b6f16072a3b /net/socket/socket_test_util.cc | |
parent | 53900d0715c882d9b8ae8281a17272143fd77143 (diff) | |
download | chromium_src-ab73904ffa1b236905a4f1253dd03e02dd9e8695.zip chromium_src-ab73904ffa1b236905a4f1253dd03e02dd9e8695.tar.gz chromium_src-ab73904ffa1b236905a4f1253dd03e02dd9e8695.tar.bz2 |
Rename a number of classes previously labeled "TCP" to "Transport" in
preparation for non-TCP transports. This helps because the alternative
is to either use non-TCP protocols (like SCTP) in classes which are called
"TCPClientSocketPool", or to clone the code as "SCTPClientSocketPool", both
of which are less than ideal.
For now, we're just testing transports, so the TransportSocketPool classes
will determine a single type of transport and just use them. In the future
we'll likely need to figure out how to deal with runtime selection of
transports, and probably support use of multiple transports either within
the same pools or within subpools. But that is for the future.
Note that the histograms have some "tcp" references to them. I didn't change
these to "transport" yet, because it will effect existing histograms.
Renames include:
classes:
TCPClientSocketPool -> TransportClientSocketPool
MockTCPClientSocketPool -> MockTransportClientSocketPool
TCPSocketParams -> TransportSocketParams
methods (not the exhaustive list):
CreateTCPClientSocket() -> CreateTransportClientSocket()
DoTCPConnect() -> DoTransportConnect()
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6804028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80781 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/socket_test_util.cc')
-rw-r--r-- | net/socket/socket_test_util.cc | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index fb4c7ae..43cdf03 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -588,7 +588,7 @@ MockSSLClientSocket* MockClientSocketFactory::GetMockSSLClientSocket( return ssl_client_sockets_[index]; } -ClientSocket* MockClientSocketFactory::CreateTCPClientSocket( +ClientSocket* MockClientSocketFactory::CreateTransportClientSocket( const AddressList& addresses, net::NetLog* net_log, const NetLog::Source& source) { @@ -1171,7 +1171,7 @@ void ClientSocketPoolTest::ReleaseAllConnections(KeepAlive keep_alive) { } while (released_one); } -MockTCPClientSocketPool::MockConnectJob::MockConnectJob( +MockTransportClientSocketPool::MockConnectJob::MockConnectJob( ClientSocket* socket, ClientSocketHandle* handle, CompletionCallback* callback) @@ -1182,9 +1182,9 @@ MockTCPClientSocketPool::MockConnectJob::MockConnectJob( connect_callback_(this, &MockConnectJob::OnConnect)) { } -MockTCPClientSocketPool::MockConnectJob::~MockConnectJob() {} +MockTransportClientSocketPool::MockConnectJob::~MockConnectJob() {} -int MockTCPClientSocketPool::MockConnectJob::Connect() { +int MockTransportClientSocketPool::MockConnectJob::Connect() { int rv = socket_->Connect(&connect_callback_); if (rv == OK) { user_callback_ = NULL; @@ -1193,7 +1193,7 @@ int MockTCPClientSocketPool::MockConnectJob::Connect() { return rv; } -bool MockTCPClientSocketPool::MockConnectJob::CancelHandle( +bool MockTransportClientSocketPool::MockConnectJob::CancelHandle( const ClientSocketHandle* handle) { if (handle != handle_) return false; @@ -1203,7 +1203,7 @@ bool MockTCPClientSocketPool::MockConnectJob::CancelHandle( return true; } -void MockTCPClientSocketPool::MockConnectJob::OnConnect(int rv) { +void MockTransportClientSocketPool::MockConnectJob::OnConnect(int rv) { if (!socket_.get()) return; if (rv == OK) { @@ -1221,27 +1221,27 @@ void MockTCPClientSocketPool::MockConnectJob::OnConnect(int rv) { } } -MockTCPClientSocketPool::MockTCPClientSocketPool( +MockTransportClientSocketPool::MockTransportClientSocketPool( int max_sockets, int max_sockets_per_group, ClientSocketPoolHistograms* histograms, ClientSocketFactory* socket_factory) - : TCPClientSocketPool(max_sockets, max_sockets_per_group, histograms, - NULL, NULL, NULL), + : TransportClientSocketPool(max_sockets, max_sockets_per_group, histograms, + NULL, NULL, NULL), client_socket_factory_(socket_factory), release_count_(0), cancel_count_(0) { } -MockTCPClientSocketPool::~MockTCPClientSocketPool() {} +MockTransportClientSocketPool::~MockTransportClientSocketPool() {} -int MockTCPClientSocketPool::RequestSocket(const std::string& group_name, +int MockTransportClientSocketPool::RequestSocket(const std::string& group_name, const void* socket_params, RequestPriority priority, ClientSocketHandle* handle, CompletionCallback* callback, const BoundNetLog& net_log) { - ClientSocket* socket = client_socket_factory_->CreateTCPClientSocket( + ClientSocket* socket = client_socket_factory_->CreateTransportClientSocket( AddressList(), net_log.net_log(), net::NetLog::Source()); MockConnectJob* job = new MockConnectJob(socket, handle, callback); job_list_.push_back(job); @@ -1249,7 +1249,7 @@ int MockTCPClientSocketPool::RequestSocket(const std::string& group_name, return job->Connect(); } -void MockTCPClientSocketPool::CancelRequest(const std::string& group_name, +void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, ClientSocketHandle* handle) { std::vector<MockConnectJob*>::iterator i; for (i = job_list_.begin(); i != job_list_.end(); ++i) { @@ -1260,7 +1260,7 @@ void MockTCPClientSocketPool::CancelRequest(const std::string& group_name, } } -void MockTCPClientSocketPool::ReleaseSocket(const std::string& group_name, +void MockTransportClientSocketPool::ReleaseSocket(const std::string& group_name, ClientSocket* socket, int id) { EXPECT_EQ(1, id); release_count_++; @@ -1292,7 +1292,7 @@ MockSSLClientSocket* DeterministicMockClientSocketFactory:: return ssl_client_sockets_[index]; } -ClientSocket* DeterministicMockClientSocketFactory::CreateTCPClientSocket( +ClientSocket* DeterministicMockClientSocketFactory::CreateTransportClientSocket( const AddressList& addresses, net::NetLog* net_log, const net::NetLog::Source& source) { @@ -1325,10 +1325,10 @@ MockSOCKSClientSocketPool::MockSOCKSClientSocketPool( int max_sockets, int max_sockets_per_group, ClientSocketPoolHistograms* histograms, - TCPClientSocketPool* tcp_pool) + TransportClientSocketPool* transport_pool) : SOCKSClientSocketPool(max_sockets, max_sockets_per_group, histograms, - NULL, tcp_pool, NULL), - tcp_pool_(tcp_pool) { + NULL, transport_pool, NULL), + transport_pool_(transport_pool) { } MockSOCKSClientSocketPool::~MockSOCKSClientSocketPool() {} @@ -1339,19 +1339,23 @@ int MockSOCKSClientSocketPool::RequestSocket(const std::string& group_name, ClientSocketHandle* handle, CompletionCallback* callback, const BoundNetLog& net_log) { - return tcp_pool_->RequestSocket(group_name, socket_params, priority, handle, - callback, net_log); + return transport_pool_->RequestSocket(group_name, + socket_params, + priority, + handle, + callback, + net_log); } void MockSOCKSClientSocketPool::CancelRequest( const std::string& group_name, ClientSocketHandle* handle) { - return tcp_pool_->CancelRequest(group_name, handle); + return transport_pool_->CancelRequest(group_name, handle); } void MockSOCKSClientSocketPool::ReleaseSocket(const std::string& group_name, ClientSocket* socket, int id) { - return tcp_pool_->ReleaseSocket(group_name, socket, id); + return transport_pool_->ReleaseSocket(group_name, socket, id); } const char kSOCKS5GreetRequest[] = { 0x05, 0x01, 0x00 }; |