OLD | NEW |
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 Loading... |
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(&OldCompletionCallback::Run<int>, | 1484 cb = base::Bind(&OldCompletionCallbackAdapter, callback); |
1485 base::Unretained(callback)); | |
1486 } | 1485 } |
1487 MockConnectJob* job = new MockConnectJob(socket, handle, cb); | 1486 MockConnectJob* job = new MockConnectJob(socket, handle, cb); |
1488 job_list_.push_back(job); | 1487 job_list_.push_back(job); |
1489 handle->set_pool_id(1); | 1488 handle->set_pool_id(1); |
1490 return job->Connect(); | 1489 return job->Connect(); |
1491 } | 1490 } |
1492 | 1491 |
1493 void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, | 1492 void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, |
1494 ClientSocketHandle* handle) { | 1493 ClientSocketHandle* handle) { |
1495 std::vector<MockConnectJob*>::iterator i; | 1494 std::vector<MockConnectJob*>::iterator i; |
1496 for (i = job_list_.begin(); i != job_list_.end(); ++i) { | 1495 for (i = job_list_.begin(); i != job_list_.end(); ++i) { |
1497 if ((*i)->CancelHandle(handle)) { | 1496 if ((*i)->CancelHandle(handle)) { |
1498 cancel_count_++; | 1497 cancel_count_++; |
1499 break; | 1498 break; |
1500 } | 1499 } |
1501 } | 1500 } |
1502 } | 1501 } |
1503 | 1502 |
1504 void MockTransportClientSocketPool::ReleaseSocket(const std::string& group_name, | 1503 void MockTransportClientSocketPool::ReleaseSocket(const std::string& group_name, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 | 1615 |
1617 const char kSOCKS5OkRequest[] = | 1616 const char kSOCKS5OkRequest[] = |
1618 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; | 1617 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; |
1619 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); | 1618 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); |
1620 | 1619 |
1621 const char kSOCKS5OkResponse[] = | 1620 const char kSOCKS5OkResponse[] = |
1622 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; | 1621 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; |
1623 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); | 1622 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); |
1624 | 1623 |
1625 } // namespace net | 1624 } // namespace net |
OLD | NEW |