| 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 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 const std::string& group_name, | 1471 const std::string& group_name, |
| 1472 const void* socket_params, | 1472 const void* socket_params, |
| 1473 RequestPriority priority, | 1473 RequestPriority priority, |
| 1474 ClientSocketHandle* handle, | 1474 ClientSocketHandle* handle, |
| 1475 OldCompletionCallback* callback, | 1475 OldCompletionCallback* callback, |
| 1476 const BoundNetLog& net_log) { | 1476 const BoundNetLog& net_log) { |
| 1477 StreamSocket* socket = client_socket_factory_->CreateTransportClientSocket( | 1477 StreamSocket* socket = client_socket_factory_->CreateTransportClientSocket( |
| 1478 AddressList(), net_log.net_log(), net::NetLog::Source()); | 1478 AddressList(), net_log.net_log(), net::NetLog::Source()); |
| 1479 CompletionCallback cb; | 1479 CompletionCallback cb; |
| 1480 if (callback) { | 1480 if (callback) { |
| 1481 cb = base::Bind(&OldCompletionCallback::Run<int>, | 1481 cb = base::Bind(&OldCompletionCallbackAdapter, callback); |
| 1482 base::Unretained(callback)); | |
| 1483 } | 1482 } |
| 1484 MockConnectJob* job = new MockConnectJob(socket, handle, cb); | 1483 MockConnectJob* job = new MockConnectJob(socket, handle, cb); |
| 1485 job_list_.push_back(job); | 1484 job_list_.push_back(job); |
| 1486 handle->set_pool_id(1); | 1485 handle->set_pool_id(1); |
| 1487 return job->Connect(); | 1486 return job->Connect(); |
| 1488 } | 1487 } |
| 1489 | 1488 |
| 1490 void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, | 1489 void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, |
| 1491 ClientSocketHandle* handle) { | 1490 ClientSocketHandle* handle) { |
| 1492 std::vector<MockConnectJob*>::iterator i; | 1491 std::vector<MockConnectJob*>::iterator i; |
| 1493 for (i = job_list_.begin(); i != job_list_.end(); ++i) { | 1492 for (i = job_list_.begin(); i != job_list_.end(); ++i) { |
| 1494 if ((*i)->CancelHandle(handle)) { | 1493 if ((*i)->CancelHandle(handle)) { |
| 1495 cancel_count_++; | 1494 cancel_count_++; |
| 1496 break; | 1495 break; |
| 1497 } | 1496 } |
| 1498 } | 1497 } |
| 1499 } | 1498 } |
| 1500 | 1499 |
| 1501 void MockTransportClientSocketPool::ReleaseSocket(const std::string& group_name, | 1500 void MockTransportClientSocketPool::ReleaseSocket(const std::string& group_name, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1613 | 1612 |
| 1614 const char kSOCKS5OkRequest[] = | 1613 const char kSOCKS5OkRequest[] = |
| 1615 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; | 1614 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; |
| 1616 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); | 1615 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); |
| 1617 | 1616 |
| 1618 const char kSOCKS5OkResponse[] = | 1617 const char kSOCKS5OkResponse[] = |
| 1619 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; | 1618 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; |
| 1620 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); | 1619 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); |
| 1621 | 1620 |
| 1622 } // namespace net | 1621 } // namespace net |
| OLD | NEW |