OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 handle_ = NULL; | 1530 handle_ = NULL; |
1531 user_callback_.Reset(); | 1531 user_callback_.Reset(); |
1532 return true; | 1532 return true; |
1533 } | 1533 } |
1534 | 1534 |
1535 void MockTransportClientSocketPool::MockConnectJob::OnConnect(int rv) { | 1535 void MockTransportClientSocketPool::MockConnectJob::OnConnect(int rv) { |
1536 if (!socket_.get()) | 1536 if (!socket_.get()) |
1537 return; | 1537 return; |
1538 if (rv == OK) { | 1538 if (rv == OK) { |
1539 handle_->set_socket(socket_.release()); | 1539 handle_->set_socket(socket_.release()); |
| 1540 |
| 1541 // Needed for socket pool tests that layer other sockets on top of mock |
| 1542 // sockets. |
| 1543 ConnectTiming connect_timing; |
| 1544 base::TimeTicks now = base::TimeTicks::Now(); |
| 1545 connect_timing.dns_start = now; |
| 1546 connect_timing.dns_end = now; |
| 1547 connect_timing.connect_start = now; |
| 1548 connect_timing.connect_end = now; |
| 1549 handle_->set_connect_timing(connect_timing); |
1540 } else { | 1550 } else { |
1541 socket_.reset(); | 1551 socket_.reset(); |
1542 } | 1552 } |
1543 | 1553 |
1544 handle_ = NULL; | 1554 handle_ = NULL; |
1545 | 1555 |
1546 if (!user_callback_.is_null()) { | 1556 if (!user_callback_.is_null()) { |
1547 CompletionCallback callback = user_callback_; | 1557 CompletionCallback callback = user_callback_; |
1548 user_callback_.Reset(); | 1558 user_callback_.Reset(); |
1549 callback.Run(rv); | 1559 callback.Run(rv); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 | 1705 |
1696 const char kSOCKS5OkRequest[] = | 1706 const char kSOCKS5OkRequest[] = |
1697 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; | 1707 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; |
1698 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); | 1708 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); |
1699 | 1709 |
1700 const char kSOCKS5OkResponse[] = | 1710 const char kSOCKS5OkResponse[] = |
1701 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; | 1711 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; |
1702 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); | 1712 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); |
1703 | 1713 |
1704 } // namespace net | 1714 } // namespace net |
OLD | NEW |