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

Unified Diff: net/socket/socket_test_util.cc

Issue 3417010: Integrate the SpdyProxyClientSocket into the HttpStreamRequest... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Rebasing again Created 10 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: net/socket/socket_test_util.cc
===================================================================
--- net/socket/socket_test_util.cc (revision 62460)
+++ net/socket/socket_test_util.cc (working copy)
@@ -127,7 +127,6 @@
void MockClientSocket::GetSSLCertRequestInfo(
net::SSLCertRequestInfo* cert_request_info) {
- NOTREACHED();
}
SSLClientSocket::NextProtoStatus
@@ -1235,100 +1234,4 @@
{ 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 };
const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse);
-MockSSLClientSocketPool::MockSSLClientSocketPool(
- int max_sockets,
- int max_sockets_per_group,
- ClientSocketPoolHistograms* histograms,
- ClientSocketFactory* socket_factory,
- TCPClientSocketPool* tcp_pool)
- : SSLClientSocketPool(max_sockets, max_sockets_per_group, histograms,
- NULL, NULL, socket_factory,
- tcp_pool,
- NULL, NULL, NULL, NULL),
- client_socket_factory_(socket_factory),
- release_count_(0),
- cancel_count_(0) {
-}
-
-int MockSSLClientSocketPool::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(
- AddressList(), net_log.net_log(), net::NetLog::Source());
- MockConnectJob* job = new MockConnectJob(socket, handle, callback);
- job_list_.push_back(job);
- handle->set_pool_id(1);
- return job->Connect();
-}
-
-void MockSSLClientSocketPool::CancelRequest(const std::string& group_name,
- ClientSocketHandle* handle) {
- std::vector<MockConnectJob*>::iterator i;
- for (i = job_list_.begin(); i != job_list_.end(); ++i) {
- if ((*i)->CancelHandle(handle)) {
- cancel_count_++;
- break;
- }
- }
-}
-
-void MockSSLClientSocketPool::ReleaseSocket(const std::string& group_name,
- ClientSocket* socket, int id) {
- EXPECT_EQ(1, id);
- release_count_++;
- delete socket;
-}
-
-MockSSLClientSocketPool::~MockSSLClientSocketPool() {}
-
-MockSSLClientSocketPool::MockConnectJob::MockConnectJob(
- ClientSocket* socket,
- ClientSocketHandle* handle,
- CompletionCallback* callback)
- : socket_(socket),
- handle_(handle),
- user_callback_(callback),
- ALLOW_THIS_IN_INITIALIZER_LIST(
- connect_callback_(this, &MockConnectJob::OnConnect)) {
-}
-
-int MockSSLClientSocketPool::MockConnectJob::Connect() {
- int rv = socket_->Connect(&connect_callback_);
- if (rv == OK) {
- user_callback_ = NULL;
- OnConnect(OK);
- }
- return rv;
-}
-
-bool MockSSLClientSocketPool::MockConnectJob::CancelHandle(
- const ClientSocketHandle* handle) {
- if (handle != handle_)
- return false;
- socket_.reset();
- handle_ = NULL;
- user_callback_ = NULL;
- return true;
-}
-
-void MockSSLClientSocketPool::MockConnectJob::OnConnect(int rv) {
- if (!socket_.get())
- return;
- if (rv == OK) {
- handle_->set_socket(socket_.release());
- } else {
- socket_.reset();
- }
-
- handle_ = NULL;
-
- if (user_callback_) {
- CompletionCallback* callback = user_callback_;
- user_callback_ = NULL;
- callback->Run(rv);
- }
-}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698