| 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/core/quic_session.h" | 8 #include "net/quic/core/quic_session.h" |
| 9 #include "net/quic/core/reliable_quic_stream.h" | 9 #include "net/quic/core/reliable_quic_stream.h" |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 // static | 81 // static |
| 82 bool QuicSessionPeer::IsStreamClosed(QuicSession* session, QuicStreamId id) { | 82 bool QuicSessionPeer::IsStreamClosed(QuicSession* session, QuicStreamId id) { |
| 83 DCHECK_NE(0u, id); | 83 DCHECK_NE(0u, id); |
| 84 return session->IsClosedStream(id); | 84 return session->IsClosedStream(id); |
| 85 } | 85 } |
| 86 | 86 |
| 87 // static | 87 // static |
| 88 bool QuicSessionPeer::IsStreamCreated(QuicSession* session, QuicStreamId id) { | 88 bool QuicSessionPeer::IsStreamCreated(QuicSession* session, QuicStreamId id) { |
| 89 DCHECK_NE(0u, id); | 89 DCHECK_NE(0u, id); |
| 90 return ContainsKey(session->dynamic_streams(), id); | 90 return base::ContainsKey(session->dynamic_streams(), id); |
| 91 } | 91 } |
| 92 | 92 |
| 93 // static | 93 // static |
| 94 bool QuicSessionPeer::IsStreamAvailable(QuicSession* session, QuicStreamId id) { | 94 bool QuicSessionPeer::IsStreamAvailable(QuicSession* session, QuicStreamId id) { |
| 95 DCHECK_NE(0u, id); | 95 DCHECK_NE(0u, id); |
| 96 return ContainsKey(session->available_streams_, id); | 96 return base::ContainsKey(session->available_streams_, id); |
| 97 } | 97 } |
| 98 | 98 |
| 99 // static | 99 // static |
| 100 bool QuicSessionPeer::IsStreamUncreated(QuicSession* session, QuicStreamId id) { | 100 bool QuicSessionPeer::IsStreamUncreated(QuicSession* session, QuicStreamId id) { |
| 101 DCHECK_NE(0u, id); | 101 DCHECK_NE(0u, id); |
| 102 if (id % 2 == session->next_outgoing_stream_id_ % 2) { | 102 if (id % 2 == session->next_outgoing_stream_id_ % 2) { |
| 103 // locally-created stream. | 103 // locally-created stream. |
| 104 return id >= session->next_outgoing_stream_id_; | 104 return id >= session->next_outgoing_stream_id_; |
| 105 } else { | 105 } else { |
| 106 // peer-created stream. | 106 // peer-created stream. |
| 107 return id > session->largest_peer_created_stream_id_; | 107 return id > session->largest_peer_created_stream_id_; |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace test | 111 } // namespace test |
| 112 } // namespace net | 112 } // namespace net |
| OLD | NEW |