OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | |
6 | |
7 #include <list> | |
8 | |
9 #include "net/quic/reliable_quic_stream.h" | |
10 | |
11 namespace net { | |
12 namespace test { | |
13 | |
14 // static | |
15 void ReliableQuicStreamPeer::SetWriteSideClosed(bool value, | |
16 ReliableQuicStream* stream) { | |
17 stream->write_side_closed_ = value; | |
18 } | |
19 | |
20 // static | |
21 void ReliableQuicStreamPeer::SetStreamBytesWritten( | |
22 QuicStreamOffset stream_bytes_written, | |
23 ReliableQuicStream* stream) { | |
24 stream->stream_bytes_written_ = stream_bytes_written; | |
25 } | |
26 | |
27 // static | |
28 void ReliableQuicStreamPeer::CloseReadSide(ReliableQuicStream* stream) { | |
29 stream->CloseReadSide(); | |
30 } | |
31 | |
32 // static | |
33 bool ReliableQuicStreamPeer::FinSent(ReliableQuicStream* stream) { | |
34 return stream->fin_sent_; | |
35 } | |
36 | |
37 // static | |
38 bool ReliableQuicStreamPeer::RstSent(ReliableQuicStream* stream) { | |
39 return stream->rst_sent_; | |
40 } | |
41 | |
42 // static | |
43 uint32 ReliableQuicStreamPeer::SizeOfQueuedData(ReliableQuicStream* stream) { | |
44 uint32 total = 0; | |
45 std::list<ReliableQuicStream::PendingData>::iterator it = | |
46 stream->queued_data_.begin(); | |
47 while (it != stream->queued_data_.end()) { | |
48 total += it->data.size(); | |
49 ++it; | |
50 } | |
51 return total; | |
52 } | |
53 | |
54 // static | |
55 void ReliableQuicStreamPeer::SetFecPolicy(ReliableQuicStream* stream, | |
56 FecPolicy fec_policy) { | |
57 stream->set_fec_policy(fec_policy); | |
58 } | |
59 | |
60 // static | |
61 bool ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( | |
62 ReliableQuicStream* stream) { | |
63 return stream->stream_contributes_to_connection_flow_control_; | |
64 } | |
65 | |
66 } // namespace test | |
67 } // namespace net | |
OLD | NEW |