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/quic/quic_session.h" | 5 #include "net/quic/quic_session.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 const QuicPriority kHighestPriority = 0; | 45 const QuicPriority kHighestPriority = 0; |
46 const QuicPriority kSomeMiddlePriority = 3; | 46 const QuicPriority kSomeMiddlePriority = 3; |
47 | 47 |
48 class TestCryptoStream : public QuicCryptoStream { | 48 class TestCryptoStream : public QuicCryptoStream { |
49 public: | 49 public: |
50 explicit TestCryptoStream(QuicSession* session) | 50 explicit TestCryptoStream(QuicSession* session) |
51 : QuicCryptoStream(session) { | 51 : QuicCryptoStream(session) { |
52 } | 52 } |
53 | 53 |
54 virtual void OnHandshakeMessage( | 54 virtual void OnHandshakeMessage( |
55 const CryptoHandshakeMessage& message) OVERRIDE { | 55 const CryptoHandshakeMessage& message) override { |
56 encryption_established_ = true; | 56 encryption_established_ = true; |
57 handshake_confirmed_ = true; | 57 handshake_confirmed_ = true; |
58 CryptoHandshakeMessage msg; | 58 CryptoHandshakeMessage msg; |
59 string error_details; | 59 string error_details; |
60 session()->config()->SetInitialFlowControlWindowToSend( | 60 session()->config()->SetInitialFlowControlWindowToSend( |
61 kInitialSessionFlowControlWindowForTest); | 61 kInitialSessionFlowControlWindowForTest); |
62 session()->config()->SetInitialStreamFlowControlWindowToSend( | 62 session()->config()->SetInitialStreamFlowControlWindowToSend( |
63 kInitialStreamFlowControlWindowForTest); | 63 kInitialStreamFlowControlWindowForTest); |
64 session()->config()->SetInitialSessionFlowControlWindowToSend( | 64 session()->config()->SetInitialSessionFlowControlWindowToSend( |
65 kInitialSessionFlowControlWindowForTest); | 65 kInitialSessionFlowControlWindowForTest); |
(...skipping 18 matching lines...) Expand all Loading... |
84 }; | 84 }; |
85 | 85 |
86 class TestStream : public QuicDataStream { | 86 class TestStream : public QuicDataStream { |
87 public: | 87 public: |
88 TestStream(QuicStreamId id, QuicSession* session) | 88 TestStream(QuicStreamId id, QuicSession* session) |
89 : QuicDataStream(id, session) { | 89 : QuicDataStream(id, session) { |
90 } | 90 } |
91 | 91 |
92 using ReliableQuicStream::CloseWriteSide; | 92 using ReliableQuicStream::CloseWriteSide; |
93 | 93 |
94 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE { | 94 virtual uint32 ProcessData(const char* data, uint32 data_len) override { |
95 return data_len; | 95 return data_len; |
96 } | 96 } |
97 | 97 |
98 void SendBody(const string& data, bool fin) { | 98 void SendBody(const string& data, bool fin) { |
99 WriteOrBufferData(data, fin, nullptr); | 99 WriteOrBufferData(data, fin, nullptr); |
100 } | 100 } |
101 | 101 |
102 MOCK_METHOD0(OnCanWrite, void()); | 102 MOCK_METHOD0(OnCanWrite, void()); |
103 }; | 103 }; |
104 | 104 |
(...skipping 17 matching lines...) Expand all Loading... |
122 class TestSession : public QuicSession { | 122 class TestSession : public QuicSession { |
123 public: | 123 public: |
124 explicit TestSession(QuicConnection* connection) | 124 explicit TestSession(QuicConnection* connection) |
125 : QuicSession(connection, | 125 : QuicSession(connection, |
126 DefaultQuicConfig()), | 126 DefaultQuicConfig()), |
127 crypto_stream_(this), | 127 crypto_stream_(this), |
128 writev_consumes_all_data_(false) { | 128 writev_consumes_all_data_(false) { |
129 InitializeSession(); | 129 InitializeSession(); |
130 } | 130 } |
131 | 131 |
132 virtual TestCryptoStream* GetCryptoStream() OVERRIDE { | 132 virtual TestCryptoStream* GetCryptoStream() override { |
133 return &crypto_stream_; | 133 return &crypto_stream_; |
134 } | 134 } |
135 | 135 |
136 virtual TestStream* CreateOutgoingDataStream() OVERRIDE { | 136 virtual TestStream* CreateOutgoingDataStream() override { |
137 TestStream* stream = new TestStream(GetNextStreamId(), this); | 137 TestStream* stream = new TestStream(GetNextStreamId(), this); |
138 ActivateStream(stream); | 138 ActivateStream(stream); |
139 return stream; | 139 return stream; |
140 } | 140 } |
141 | 141 |
142 virtual TestStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE { | 142 virtual TestStream* CreateIncomingDataStream(QuicStreamId id) override { |
143 return new TestStream(id, this); | 143 return new TestStream(id, this); |
144 } | 144 } |
145 | 145 |
146 bool IsClosedStream(QuicStreamId id) { | 146 bool IsClosedStream(QuicStreamId id) { |
147 return QuicSession::IsClosedStream(id); | 147 return QuicSession::IsClosedStream(id); |
148 } | 148 } |
149 | 149 |
150 QuicDataStream* GetIncomingDataStream(QuicStreamId stream_id) { | 150 QuicDataStream* GetIncomingDataStream(QuicStreamId stream_id) { |
151 return QuicSession::GetIncomingDataStream(stream_id); | 151 return QuicSession::GetIncomingDataStream(stream_id); |
152 } | 152 } |
153 | 153 |
154 virtual QuicConsumedData WritevData( | 154 virtual QuicConsumedData WritevData( |
155 QuicStreamId id, | 155 QuicStreamId id, |
156 const IOVector& data, | 156 const IOVector& data, |
157 QuicStreamOffset offset, | 157 QuicStreamOffset offset, |
158 bool fin, | 158 bool fin, |
159 FecProtection fec_protection, | 159 FecProtection fec_protection, |
160 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) OVERRIDE { | 160 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) override { |
161 // Always consumes everything. | 161 // Always consumes everything. |
162 if (writev_consumes_all_data_) { | 162 if (writev_consumes_all_data_) { |
163 return QuicConsumedData(data.TotalBufferSize(), fin); | 163 return QuicConsumedData(data.TotalBufferSize(), fin); |
164 } else { | 164 } else { |
165 return QuicSession::WritevData(id, data, offset, fin, fec_protection, | 165 return QuicSession::WritevData(id, data, offset, fin, fec_protection, |
166 ack_notifier_delegate); | 166 ack_notifier_delegate); |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 void set_writev_consumes_all_data(bool val) { | 170 void set_writev_consumes_all_data(bool val) { |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 } | 945 } |
946 | 946 |
947 // Called after any new data is received by the session, and triggers the call | 947 // Called after any new data is received by the session, and triggers the call |
948 // to close the connection. | 948 // to close the connection. |
949 session_.PostProcessAfterData(); | 949 session_.PostProcessAfterData(); |
950 } | 950 } |
951 | 951 |
952 } // namespace | 952 } // namespace |
953 } // namespace test | 953 } // namespace test |
954 } // namespace net | 954 } // namespace net |
OLD | NEW |