| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 QuicSession* const session_; | 121 QuicSession* const session_; |
| 122 const QuicStreamId stream_id_; | 122 const QuicStreamId stream_id_; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 class TestSession : public QuicSession { | 125 class TestSession : public QuicSession { |
| 126 public: | 126 public: |
| 127 explicit TestSession(QuicConnection* connection) | 127 explicit TestSession(QuicConnection* connection) |
| 128 : QuicSession(connection, | 128 : QuicSession(connection, |
| 129 DefaultQuicConfig()), | 129 DefaultQuicConfig(), |
| 130 false), |
| 130 crypto_stream_(this), | 131 crypto_stream_(this), |
| 131 writev_consumes_all_data_(false) { | 132 writev_consumes_all_data_(false) { |
| 132 InitializeSession(); | 133 InitializeSession(); |
| 133 } | 134 } |
| 134 | 135 |
| 135 virtual TestCryptoStream* GetCryptoStream() override { | 136 virtual TestCryptoStream* GetCryptoStream() override { |
| 136 return &crypto_stream_; | 137 return &crypto_stream_; |
| 137 } | 138 } |
| 138 | 139 |
| 139 virtual TestStream* CreateOutgoingDataStream() override { | 140 virtual TestStream* CreateOutgoingDataStream() override { |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 TestStream* stream4 = session_.CreateOutgoingDataStream(); | 393 TestStream* stream4 = session_.CreateOutgoingDataStream(); |
| 393 TestStream* stream6 = session_.CreateOutgoingDataStream(); | 394 TestStream* stream6 = session_.CreateOutgoingDataStream(); |
| 394 | 395 |
| 395 session_.MarkWriteBlocked(stream2->id(), kSomeMiddlePriority); | 396 session_.MarkWriteBlocked(stream2->id(), kSomeMiddlePriority); |
| 396 session_.MarkWriteBlocked(stream6->id(), kSomeMiddlePriority); | 397 session_.MarkWriteBlocked(stream6->id(), kSomeMiddlePriority); |
| 397 session_.MarkWriteBlocked(stream4->id(), kSomeMiddlePriority); | 398 session_.MarkWriteBlocked(stream4->id(), kSomeMiddlePriority); |
| 398 | 399 |
| 399 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _)).WillRepeatedly( | 400 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _, _)).WillRepeatedly( |
| 400 Return(QuicTime::Delta::Zero())); | 401 Return(QuicTime::Delta::Zero())); |
| 401 EXPECT_CALL(*send_algorithm, GetCongestionWindow()) | 402 EXPECT_CALL(*send_algorithm, GetCongestionWindow()) |
| 402 .WillOnce(Return(kMaxPacketSize * 10)); | 403 .WillRepeatedly(Return(kMaxPacketSize * 10)); |
| 403 EXPECT_CALL(*stream2, OnCanWrite()) | 404 EXPECT_CALL(*stream2, OnCanWrite()) |
| 404 .WillOnce(IgnoreResult(Invoke(CreateFunctor( | 405 .WillOnce(IgnoreResult(Invoke(CreateFunctor( |
| 405 &session_, &TestSession::SendStreamData, stream2->id())))); | 406 &session_, &TestSession::SendStreamData, stream2->id())))); |
| 406 EXPECT_CALL(*stream4, OnCanWrite()) | 407 EXPECT_CALL(*stream4, OnCanWrite()) |
| 407 .WillOnce(IgnoreResult(Invoke(CreateFunctor( | 408 .WillOnce(IgnoreResult(Invoke(CreateFunctor( |
| 408 &session_, &TestSession::SendStreamData, stream4->id())))); | 409 &session_, &TestSession::SendStreamData, stream4->id())))); |
| 409 EXPECT_CALL(*stream6, OnCanWrite()) | 410 EXPECT_CALL(*stream6, OnCanWrite()) |
| 410 .WillOnce(IgnoreResult(Invoke(CreateFunctor( | 411 .WillOnce(IgnoreResult(Invoke(CreateFunctor( |
| 411 &session_, &TestSession::SendStreamData, stream6->id())))); | 412 &session_, &TestSession::SendStreamData, stream6->id())))); |
| 412 | 413 |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 } | 1019 } |
| 1019 | 1020 |
| 1020 // Called after any new data is received by the session, and triggers the call | 1021 // Called after any new data is received by the session, and triggers the call |
| 1021 // to close the connection. | 1022 // to close the connection. |
| 1022 session_.PostProcessAfterData(); | 1023 session_.PostProcessAfterData(); |
| 1023 } | 1024 } |
| 1024 | 1025 |
| 1025 } // namespace | 1026 } // namespace |
| 1026 } // namespace test | 1027 } // namespace test |
| 1027 } // namespace net | 1028 } // namespace net |
| OLD | NEW |