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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 RunCallback(callback, data.result); | 950 RunCallback(callback, data.result); |
951 } | 951 } |
952 | 952 |
953 int MockTCPClientSocket::CompleteRead() { | 953 int MockTCPClientSocket::CompleteRead() { |
954 DCHECK(pending_buf_); | 954 DCHECK(pending_buf_); |
955 DCHECK(pending_buf_len_ > 0); | 955 DCHECK(pending_buf_len_ > 0); |
956 | 956 |
957 was_used_to_convey_data_ = true; | 957 was_used_to_convey_data_ = true; |
958 | 958 |
959 // Save the pending async IO data and reset our |pending_| state. | 959 // Save the pending async IO data and reset our |pending_| state. |
960 scoped_refptr<IOBuffer> buf = pending_buf_; | 960 IOBuffer* buf = pending_buf_; |
961 int buf_len = pending_buf_len_; | 961 int buf_len = pending_buf_len_; |
962 CompletionCallback callback = pending_callback_; | 962 CompletionCallback callback = pending_callback_; |
963 pending_buf_ = NULL; | 963 pending_buf_ = NULL; |
964 pending_buf_len_ = 0; | 964 pending_buf_len_ = 0; |
965 pending_callback_.Reset(); | 965 pending_callback_.Reset(); |
966 | 966 |
967 int result = read_data_.result; | 967 int result = read_data_.result; |
968 DCHECK(result != ERR_IO_PENDING); | 968 DCHECK(result != ERR_IO_PENDING); |
969 | 969 |
970 if (read_data_.data) { | 970 if (read_data_.data) { |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 | 1549 |
1550 void MockUDPClientSocket::OnConnectComplete(const MockConnect& data) { | 1550 void MockUDPClientSocket::OnConnectComplete(const MockConnect& data) { |
1551 NOTIMPLEMENTED(); | 1551 NOTIMPLEMENTED(); |
1552 } | 1552 } |
1553 | 1553 |
1554 int MockUDPClientSocket::CompleteRead() { | 1554 int MockUDPClientSocket::CompleteRead() { |
1555 DCHECK(pending_buf_); | 1555 DCHECK(pending_buf_); |
1556 DCHECK(pending_buf_len_ > 0); | 1556 DCHECK(pending_buf_len_ > 0); |
1557 | 1557 |
1558 // Save the pending async IO data and reset our |pending_| state. | 1558 // Save the pending async IO data and reset our |pending_| state. |
1559 scoped_refptr<IOBuffer> buf = pending_buf_; | 1559 IOBuffer* buf = pending_buf_; |
1560 int buf_len = pending_buf_len_; | 1560 int buf_len = pending_buf_len_; |
1561 CompletionCallback callback = pending_callback_; | 1561 CompletionCallback callback = pending_callback_; |
1562 pending_buf_ = NULL; | 1562 pending_buf_ = NULL; |
1563 pending_buf_len_ = 0; | 1563 pending_buf_len_ = 0; |
1564 pending_callback_.Reset(); | 1564 pending_callback_.Reset(); |
1565 | 1565 |
1566 int result = read_data_.result; | 1566 int result = read_data_.result; |
1567 DCHECK(result != ERR_IO_PENDING); | 1567 DCHECK(result != ERR_IO_PENDING); |
1568 | 1568 |
1569 if (read_data_.data) { | 1569 if (read_data_.data) { |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 | 1881 |
1882 const char kSOCKS5OkRequest[] = | 1882 const char kSOCKS5OkRequest[] = |
1883 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; | 1883 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; |
1884 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); | 1884 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); |
1885 | 1885 |
1886 const char kSOCKS5OkResponse[] = | 1886 const char kSOCKS5OkResponse[] = |
1887 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; | 1887 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; |
1888 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); | 1888 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); |
1889 | 1889 |
1890 } // namespace net | 1890 } // namespace net |
OLD | NEW |