Roll src/third_party/WebKit eac3800:0237a66 (svn 202606:202607)
[chromium-blink-merge.git] / net / quic / test_tools / reliable_quic_stream_peer.cc
bloba2646b74f7d323a23efe4c4fec4efea489d15af3
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.
5 #include "net/quic/test_tools/reliable_quic_stream_peer.h"
7 #include <list>
9 #include "net/quic/reliable_quic_stream.h"
11 using base::StringPiece;
13 namespace net {
14 namespace test {
16 // static
17 void ReliableQuicStreamPeer::SetWriteSideClosed(bool value,
18 ReliableQuicStream* stream) {
19 stream->write_side_closed_ = value;
22 // static
23 void ReliableQuicStreamPeer::SetStreamBytesWritten(
24 QuicStreamOffset stream_bytes_written,
25 ReliableQuicStream* stream) {
26 stream->stream_bytes_written_ = stream_bytes_written;
29 // static
30 void ReliableQuicStreamPeer::CloseReadSide(ReliableQuicStream* stream) {
31 stream->CloseReadSide();
34 // static
35 bool ReliableQuicStreamPeer::FinSent(ReliableQuicStream* stream) {
36 return stream->fin_sent_;
39 // static
40 bool ReliableQuicStreamPeer::RstSent(ReliableQuicStream* stream) {
41 return stream->rst_sent_;
44 // static
45 uint32 ReliableQuicStreamPeer::SizeOfQueuedData(ReliableQuicStream* stream) {
46 uint32 total = 0;
47 std::list<ReliableQuicStream::PendingData>::iterator it =
48 stream->queued_data_.begin();
49 while (it != stream->queued_data_.end()) {
50 total += it->data.size();
51 ++it;
53 return total;
56 // static
57 void ReliableQuicStreamPeer::SetFecPolicy(ReliableQuicStream* stream,
58 FecPolicy fec_policy) {
59 stream->set_fec_policy(fec_policy);
62 // static
63 bool ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl(
64 ReliableQuicStream* stream) {
65 return stream->stream_contributes_to_connection_flow_control_;
68 // static
69 void ReliableQuicStreamPeer::WriteOrBufferData(
70 ReliableQuicStream* stream,
71 StringPiece data,
72 bool fin,
73 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) {
74 stream->WriteOrBufferData(data, fin, ack_notifier_delegate);
77 } // namespace test
78 } // namespace net