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

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

Issue 7189055: Deciding best connection to schedule requests on based on cwnd and idle time (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: syncing to head Created 9 years, 6 months 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
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 10
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 } 793 }
794 794
795 bool MockTCPClientSocket::WasEverUsed() const { 795 bool MockTCPClientSocket::WasEverUsed() const {
796 return was_used_to_convey_data_; 796 return was_used_to_convey_data_;
797 } 797 }
798 798
799 bool MockTCPClientSocket::UsingTCPFastOpen() const { 799 bool MockTCPClientSocket::UsingTCPFastOpen() const {
800 return false; 800 return false;
801 } 801 }
802 802
803 int64 MockTCPClientSocket::NumBytesRead() const {
804 return -1;
805 }
806
807 int MockTCPClientSocket::GetConnectTimeMicros() const {
808 return -1;
809 }
810
803 void MockTCPClientSocket::OnReadComplete(const MockRead& data) { 811 void MockTCPClientSocket::OnReadComplete(const MockRead& data) {
804 // There must be a read pending. 812 // There must be a read pending.
805 DCHECK(pending_buf_); 813 DCHECK(pending_buf_);
806 // You can't complete a read with another ERR_IO_PENDING status code. 814 // You can't complete a read with another ERR_IO_PENDING status code.
807 DCHECK_NE(ERR_IO_PENDING, data.result); 815 DCHECK_NE(ERR_IO_PENDING, data.result);
808 // Since we've been waiting for data, need_read_data_ should be true. 816 // Since we've been waiting for data, need_read_data_ should be true.
809 DCHECK(need_read_data_); 817 DCHECK(need_read_data_);
810 818
811 read_data_ = data; 819 read_data_ = data;
812 need_read_data_ = false; 820 need_read_data_ = false;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 } 991 }
984 992
985 bool DeterministicMockTCPClientSocket::WasEverUsed() const { 993 bool DeterministicMockTCPClientSocket::WasEverUsed() const {
986 return was_used_to_convey_data_; 994 return was_used_to_convey_data_;
987 } 995 }
988 996
989 bool DeterministicMockTCPClientSocket::UsingTCPFastOpen() const { 997 bool DeterministicMockTCPClientSocket::UsingTCPFastOpen() const {
990 return false; 998 return false;
991 } 999 }
992 1000
1001 int64 DeterministicMockTCPClientSocket::NumBytesRead() const {
1002 return -1;
1003 }
1004
1005 int DeterministicMockTCPClientSocket::GetConnectTimeMicros() const {
1006 return -1;
1007 }
1008
993 void DeterministicMockTCPClientSocket::OnReadComplete(const MockRead& data) {} 1009 void DeterministicMockTCPClientSocket::OnReadComplete(const MockRead& data) {}
994 1010
995 class MockSSLClientSocket::ConnectCallback 1011 class MockSSLClientSocket::ConnectCallback
996 : public net::CompletionCallbackImpl<MockSSLClientSocket::ConnectCallback> { 1012 : public net::CompletionCallbackImpl<MockSSLClientSocket::ConnectCallback> {
997 public: 1013 public:
998 ConnectCallback(MockSSLClientSocket *ssl_client_socket, 1014 ConnectCallback(MockSSLClientSocket *ssl_client_socket,
999 net::CompletionCallback* user_callback, 1015 net::CompletionCallback* user_callback,
1000 int rv) 1016 int rv)
1001 : ALLOW_THIS_IN_INITIALIZER_LIST( 1017 : ALLOW_THIS_IN_INITIALIZER_LIST(
1002 net::CompletionCallbackImpl<MockSSLClientSocket::ConnectCallback>( 1018 net::CompletionCallbackImpl<MockSSLClientSocket::ConnectCallback>(
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 } 1092 }
1077 1093
1078 bool MockSSLClientSocket::WasEverUsed() const { 1094 bool MockSSLClientSocket::WasEverUsed() const {
1079 return transport_->socket()->WasEverUsed(); 1095 return transport_->socket()->WasEverUsed();
1080 } 1096 }
1081 1097
1082 bool MockSSLClientSocket::UsingTCPFastOpen() const { 1098 bool MockSSLClientSocket::UsingTCPFastOpen() const {
1083 return transport_->socket()->UsingTCPFastOpen(); 1099 return transport_->socket()->UsingTCPFastOpen();
1084 } 1100 }
1085 1101
1102 int64 MockSSLClientSocket::NumBytesRead() const {
1103 return -1;
1104 }
1105
1106 int MockSSLClientSocket::GetConnectTimeMicros() const {
1107 return -1;
1108 }
1109
1086 void MockSSLClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) { 1110 void MockSSLClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) {
1087 ssl_info->Reset(); 1111 ssl_info->Reset();
1088 ssl_info->cert = data_->cert_; 1112 ssl_info->cert = data_->cert_;
1089 } 1113 }
1090 1114
1091 void MockSSLClientSocket::GetSSLCertRequestInfo( 1115 void MockSSLClientSocket::GetSSLCertRequestInfo(
1092 net::SSLCertRequestInfo* cert_request_info) { 1116 net::SSLCertRequestInfo* cert_request_info) {
1093 DCHECK(cert_request_info); 1117 DCHECK(cert_request_info);
1094 if (data_->cert_request_info) { 1118 if (data_->cert_request_info) {
1095 cert_request_info->host_and_port = 1119 cert_request_info->host_and_port =
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 1404
1381 const char kSOCKS5OkRequest[] = 1405 const char kSOCKS5OkRequest[] =
1382 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; 1406 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 };
1383 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); 1407 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest);
1384 1408
1385 const char kSOCKS5OkResponse[] = 1409 const char kSOCKS5OkResponse[] =
1386 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; 1410 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 };
1387 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); 1411 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse);
1388 1412
1389 } // namespace net 1413 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698