| 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_session_peer.h" | 5 #include "net/quic/test_tools/quic_session_peer.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "net/quic/quic_session.h" | 8 #include "net/quic/quic_session.h" |
| 9 #include "net/quic/reliable_quic_stream.h" | 9 #include "net/quic/reliable_quic_stream.h" |
| 10 | 10 |
| 11 using std::map; | 11 using std::map; |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 namespace test { | 14 namespace test { |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 QuicStreamId QuicSessionPeer::GetNextStreamId(QuicSession* session) { | 17 QuicStreamId QuicSessionPeer::GetNextOutgoingStreamId(QuicSession* session) { |
| 18 return session->GetNextStreamId(); | 18 return session->GetNextOutgoingStreamId(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 // static | 21 // static |
| 22 void QuicSessionPeer::SetNextStreamId(QuicSession* session, QuicStreamId id) { | 22 void QuicSessionPeer::SetNextOutgoingStreamId(QuicSession* session, |
| 23 session->next_stream_id_ = id; | 23 QuicStreamId id) { |
| 24 session->next_outgoing_stream_id_ = id; |
| 24 } | 25 } |
| 25 | 26 |
| 26 // static | 27 // static |
| 27 void QuicSessionPeer::SetMaxOpenStreams(QuicSession* session, | 28 void QuicSessionPeer::SetMaxOpenStreams(QuicSession* session, |
| 28 uint32 max_streams) { | 29 uint32 max_streams) { |
| 29 session->max_open_streams_ = max_streams; | 30 session->max_open_streams_ = max_streams; |
| 30 } | 31 } |
| 31 | 32 |
| 32 // static | 33 // static |
| 33 QuicCryptoStream* QuicSessionPeer::GetCryptoStream(QuicSession* session) { | 34 QuicCryptoStream* QuicSessionPeer::GetCryptoStream(QuicSession* session) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 84 |
| 84 // static | 85 // static |
| 85 bool QuicSessionPeer::IsStreamAvailable(QuicSession* session, QuicStreamId id) { | 86 bool QuicSessionPeer::IsStreamAvailable(QuicSession* session, QuicStreamId id) { |
| 86 DCHECK_NE(0u, id); | 87 DCHECK_NE(0u, id); |
| 87 return ContainsKey(session->available_streams_, id); | 88 return ContainsKey(session->available_streams_, id); |
| 88 } | 89 } |
| 89 | 90 |
| 90 // static | 91 // static |
| 91 bool QuicSessionPeer::IsStreamUncreated(QuicSession* session, QuicStreamId id) { | 92 bool QuicSessionPeer::IsStreamUncreated(QuicSession* session, QuicStreamId id) { |
| 92 DCHECK_NE(0u, id); | 93 DCHECK_NE(0u, id); |
| 93 if (id % 2 == session->next_stream_id_ % 2) { | 94 if (id % 2 == session->next_outgoing_stream_id_ % 2) { |
| 94 // locally-created stream. | 95 // locally-created stream. |
| 95 return id >= session->next_stream_id_; | 96 return id >= session->next_outgoing_stream_id_; |
| 96 } else { | 97 } else { |
| 97 // peer-created stream. | 98 // peer-created stream. |
| 98 return id > session->largest_peer_created_stream_id_; | 99 return id > session->largest_peer_created_stream_id_; |
| 99 } | 100 } |
| 100 } | 101 } |
| 101 | 102 |
| 102 } // namespace test | 103 } // namespace test |
| 103 } // namespace net | 104 } // namespace net |
| OLD | NEW |