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/test_tools/quic_test_utils.h" | 5 #include "net/quic/test_tools/quic_test_utils.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "net/quic/crypto/crypto_framer.h" | 9 #include "net/quic/crypto/crypto_framer.h" |
10 #include "net/quic/crypto/crypto_handshake.h" | 10 #include "net/quic/crypto/crypto_handshake.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 ON_CALL(*this, OnStreamFrame(_)) | 59 ON_CALL(*this, OnStreamFrame(_)) |
60 .WillByDefault(testing::Return(true)); | 60 .WillByDefault(testing::Return(true)); |
61 | 61 |
62 ON_CALL(*this, OnAckFrame(_)) | 62 ON_CALL(*this, OnAckFrame(_)) |
63 .WillByDefault(testing::Return(true)); | 63 .WillByDefault(testing::Return(true)); |
64 | 64 |
65 ON_CALL(*this, OnCongestionFeedbackFrame(_)) | 65 ON_CALL(*this, OnCongestionFeedbackFrame(_)) |
66 .WillByDefault(testing::Return(true)); | 66 .WillByDefault(testing::Return(true)); |
67 | 67 |
| 68 ON_CALL(*this, OnStopWaitingFrame(_)) |
| 69 .WillByDefault(testing::Return(true)); |
| 70 |
68 ON_CALL(*this, OnRstStreamFrame(_)) | 71 ON_CALL(*this, OnRstStreamFrame(_)) |
69 .WillByDefault(testing::Return(true)); | 72 .WillByDefault(testing::Return(true)); |
70 | 73 |
71 ON_CALL(*this, OnConnectionCloseFrame(_)) | 74 ON_CALL(*this, OnConnectionCloseFrame(_)) |
72 .WillByDefault(testing::Return(true)); | 75 .WillByDefault(testing::Return(true)); |
73 | 76 |
74 ON_CALL(*this, OnGoAwayFrame(_)) | 77 ON_CALL(*this, OnGoAwayFrame(_)) |
75 .WillByDefault(testing::Return(true)); | 78 .WillByDefault(testing::Return(true)); |
76 } | 79 } |
77 | 80 |
(...skipping 24 matching lines...) Expand all Loading... |
102 | 105 |
103 bool NoOpFramerVisitor::OnAckFrame(const QuicAckFrame& frame) { | 106 bool NoOpFramerVisitor::OnAckFrame(const QuicAckFrame& frame) { |
104 return true; | 107 return true; |
105 } | 108 } |
106 | 109 |
107 bool NoOpFramerVisitor::OnCongestionFeedbackFrame( | 110 bool NoOpFramerVisitor::OnCongestionFeedbackFrame( |
108 const QuicCongestionFeedbackFrame& frame) { | 111 const QuicCongestionFeedbackFrame& frame) { |
109 return true; | 112 return true; |
110 } | 113 } |
111 | 114 |
| 115 bool NoOpFramerVisitor::OnStopWaitingFrame( |
| 116 const QuicStopWaitingFrame& frame) { |
| 117 return true; |
| 118 } |
| 119 |
112 bool NoOpFramerVisitor::OnRstStreamFrame( | 120 bool NoOpFramerVisitor::OnRstStreamFrame( |
113 const QuicRstStreamFrame& frame) { | 121 const QuicRstStreamFrame& frame) { |
114 return true; | 122 return true; |
115 } | 123 } |
116 | 124 |
117 bool NoOpFramerVisitor::OnConnectionCloseFrame( | 125 bool NoOpFramerVisitor::OnConnectionCloseFrame( |
118 const QuicConnectionCloseFrame& frame) { | 126 const QuicConnectionCloseFrame& frame) { |
119 return true; | 127 return true; |
120 } | 128 } |
121 | 129 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 return true; | 185 return true; |
178 } | 186 } |
179 | 187 |
180 bool FramerVisitorCapturingFrames::OnCongestionFeedbackFrame( | 188 bool FramerVisitorCapturingFrames::OnCongestionFeedbackFrame( |
181 const QuicCongestionFeedbackFrame& frame) { | 189 const QuicCongestionFeedbackFrame& frame) { |
182 feedback_.reset(new QuicCongestionFeedbackFrame(frame)); | 190 feedback_.reset(new QuicCongestionFeedbackFrame(frame)); |
183 ++frame_count_; | 191 ++frame_count_; |
184 return true; | 192 return true; |
185 } | 193 } |
186 | 194 |
| 195 bool FramerVisitorCapturingFrames::OnStopWaitingFrame( |
| 196 const QuicStopWaitingFrame& frame) { |
| 197 stop_waiting_.reset(new QuicStopWaitingFrame(frame)); |
| 198 ++frame_count_; |
| 199 return true; |
| 200 } |
| 201 |
187 bool FramerVisitorCapturingFrames::OnRstStreamFrame( | 202 bool FramerVisitorCapturingFrames::OnRstStreamFrame( |
188 const QuicRstStreamFrame& frame) { | 203 const QuicRstStreamFrame& frame) { |
189 rst_.reset(new QuicRstStreamFrame(frame)); | 204 rst_.reset(new QuicRstStreamFrame(frame)); |
190 ++frame_count_; | 205 ++frame_count_; |
191 return true; | 206 return true; |
192 } | 207 } |
193 | 208 |
194 bool FramerVisitorCapturingFrames::OnConnectionCloseFrame( | 209 bool FramerVisitorCapturingFrames::OnConnectionCloseFrame( |
195 const QuicConnectionCloseFrame& frame) { | 210 const QuicConnectionCloseFrame& frame) { |
196 close_.reset(new QuicConnectionCloseFrame(frame)); | 211 close_.reset(new QuicConnectionCloseFrame(frame)); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 TransmissionType transmission_type) { | 333 TransmissionType transmission_type) { |
319 packets_.push_back(packet.packet); | 334 packets_.push_back(packet.packet); |
320 QuicEncryptedPacket* encrypted = QuicConnectionPeer::GetFramer(this)-> | 335 QuicEncryptedPacket* encrypted = QuicConnectionPeer::GetFramer(this)-> |
321 EncryptPacket(level, packet.sequence_number, *packet.packet); | 336 EncryptPacket(level, packet.sequence_number, *packet.packet); |
322 encrypted_packets_.push_back(encrypted); | 337 encrypted_packets_.push_back(encrypted); |
323 return true; | 338 return true; |
324 } | 339 } |
325 | 340 |
326 MockSession::MockSession(QuicConnection* connection) | 341 MockSession::MockSession(QuicConnection* connection) |
327 : QuicSession(connection, DefaultQuicConfig()) { | 342 : QuicSession(connection, DefaultQuicConfig()) { |
328 ON_CALL(*this, WritevData(_, _, _, _, _, _)) | 343 ON_CALL(*this, WritevData(_, _, _, _, _)) |
329 .WillByDefault(testing::Return(QuicConsumedData(0, false))); | 344 .WillByDefault(testing::Return(QuicConsumedData(0, false))); |
330 } | 345 } |
331 | 346 |
332 MockSession::~MockSession() { | 347 MockSession::~MockSession() { |
333 } | 348 } |
334 | 349 |
335 TestSession::TestSession(QuicConnection* connection, | 350 TestSession::TestSession(QuicConnection* connection, |
336 const QuicConfig& config) | 351 const QuicConfig& config) |
337 : QuicSession(connection, config), | 352 : QuicSession(connection, config), |
338 crypto_stream_(NULL) { | 353 crypto_stream_(NULL) { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 data.AppendToString(&data_); | 567 data.AppendToString(&data_); |
553 return true; | 568 return true; |
554 } | 569 } |
555 | 570 |
556 void TestDecompressorVisitor::OnDecompressionError() { | 571 void TestDecompressorVisitor::OnDecompressionError() { |
557 error_ = true; | 572 error_ = true; |
558 } | 573 } |
559 | 574 |
560 } // namespace test | 575 } // namespace test |
561 } // namespace net | 576 } // namespace net |
OLD | NEW |