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

Side by Side Diff: net/socket/socket_test_util.cc

Issue 8914022: Revert 114494 - Remove BindStateHolder and have Bind() return a Callback<> object directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 | « net/net.gyp ('k') | net/socket/web_socket_server_socket.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/socket/socket_test_util.h" 5 #include "net/socket/socket_test_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 const std::string& group_name, 1474 const std::string& group_name,
1475 const void* socket_params, 1475 const void* socket_params,
1476 RequestPriority priority, 1476 RequestPriority priority,
1477 ClientSocketHandle* handle, 1477 ClientSocketHandle* handle,
1478 OldCompletionCallback* callback, 1478 OldCompletionCallback* callback,
1479 const BoundNetLog& net_log) { 1479 const BoundNetLog& net_log) {
1480 StreamSocket* socket = client_socket_factory_->CreateTransportClientSocket( 1480 StreamSocket* socket = client_socket_factory_->CreateTransportClientSocket(
1481 AddressList(), net_log.net_log(), net::NetLog::Source()); 1481 AddressList(), net_log.net_log(), net::NetLog::Source());
1482 CompletionCallback cb; 1482 CompletionCallback cb;
1483 if (callback) { 1483 if (callback) {
1484 cb = base::Bind(&OldCompletionCallbackAdapter, callback); 1484 cb = base::Bind(&OldCompletionCallback::Run<int>,
1485 base::Unretained(callback));
1485 } 1486 }
1486 MockConnectJob* job = new MockConnectJob(socket, handle, cb); 1487 MockConnectJob* job = new MockConnectJob(socket, handle, cb);
1487 job_list_.push_back(job); 1488 job_list_.push_back(job);
1488 handle->set_pool_id(1); 1489 handle->set_pool_id(1);
1489 return job->Connect(); 1490 return job->Connect();
1490 } 1491 }
1491 1492
1492 void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, 1493 void MockTransportClientSocketPool::CancelRequest(const std::string& group_name,
1493 ClientSocketHandle* handle) { 1494 ClientSocketHandle* handle) {
1494 std::vector<MockConnectJob*>::iterator i; 1495 std::vector<MockConnectJob*>::iterator i;
1495 for (i = job_list_.begin(); i != job_list_.end(); ++i) { 1496 for (i = job_list_.begin(); i != job_list_.end(); ++i) {
1496 if ((*i)->CancelHandle(handle)) { 1497 if ((*i)->CancelHandle(handle)) {
1497 cancel_count_++; 1498 cancel_count_++;
1498 break; 1499 break;
1499 } 1500 }
1500 } 1501 }
1501 } 1502 }
1502 1503
1503 void MockTransportClientSocketPool::ReleaseSocket(const std::string& group_name, 1504 void MockTransportClientSocketPool::ReleaseSocket(const std::string& group_name,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 1616
1616 const char kSOCKS5OkRequest[] = 1617 const char kSOCKS5OkRequest[] =
1617 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; 1618 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 };
1618 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); 1619 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest);
1619 1620
1620 const char kSOCKS5OkResponse[] = 1621 const char kSOCKS5OkResponse[] =
1621 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; 1622 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 };
1622 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); 1623 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse);
1623 1624
1624 } // namespace net 1625 } // namespace net
OLDNEW
« no previous file with comments | « net/net.gyp ('k') | net/socket/web_socket_server_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698