Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: webrtc/p2p/quic/reliablequicstream_unittest.cc

Issue 1910633003: Update QuicTransportChannel to latest version of libquic (Chromium: f03d2c62) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Sync to upstream Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/quic/quictransportchannel.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/p2p/quic/reliablequicstream.h" 11 #include "webrtc/p2p/quic/reliablequicstream.h"
12 12
13 #include <memory> 13 #include <memory>
14 #include <string> 14 #include <string>
15 15
16 #include "net/base/ip_address_number.h" 16 #include "net/base/ip_address_number.h"
17 #include "net/quic/quic_connection.h" 17 #include "net/quic/quic_connection.h"
18 #include "net/quic/quic_protocol.h" 18 #include "net/quic/quic_protocol.h"
19 #include "net/quic/quic_session.h" 19 #include "net/quic/quic_session.h"
20 #include "webrtc/base/buffer.h" 20 #include "webrtc/base/buffer.h"
21 #include "webrtc/base/gunit.h" 21 #include "webrtc/base/gunit.h"
22 #include "webrtc/base/sigslot.h" 22 #include "webrtc/base/sigslot.h"
23 #include "webrtc/base/stream.h" 23 #include "webrtc/base/stream.h"
24 #include "webrtc/p2p/quic/quicconnectionhelper.h" 24 #include "webrtc/p2p/quic/quicconnectionhelper.h"
25 25
26 using cricket::QuicConnectionHelper; 26 using cricket::QuicConnectionHelper;
27 using cricket::ReliableQuicStream; 27 using cricket::ReliableQuicStream;
28 28
29 using net::FecProtection;
30 using net::IPAddress; 29 using net::IPAddress;
31 using net::IPEndPoint; 30 using net::IPEndPoint;
32 using net::PerPacketOptions; 31 using net::PerPacketOptions;
33 using net::Perspective; 32 using net::Perspective;
34 using net::QuicAckListenerInterface; 33 using net::QuicAckListenerInterface;
35 using net::QuicConfig; 34 using net::QuicConfig;
36 using net::QuicConnection; 35 using net::QuicConnection;
37 using net::QuicConsumedData; 36 using net::QuicConsumedData;
38 using net::QuicCryptoStream; 37 using net::QuicCryptoStream;
39 using net::QuicErrorCode; 38 using net::QuicErrorCode;
(...skipping 19 matching lines...) Expand all
59 const QuicConfig& config, 58 const QuicConfig& config,
60 std::string* write_buffer) 59 std::string* write_buffer)
61 : QuicSession(connection, config), write_buffer_(write_buffer) {} 60 : QuicSession(connection, config), write_buffer_(write_buffer) {}
62 61
63 // Writes outgoing data from ReliableQuicStream to a string. 62 // Writes outgoing data from ReliableQuicStream to a string.
64 QuicConsumedData WritevData( 63 QuicConsumedData WritevData(
65 QuicStreamId id, 64 QuicStreamId id,
66 QuicIOVector iovector, 65 QuicIOVector iovector,
67 QuicStreamOffset offset, 66 QuicStreamOffset offset,
68 bool fin, 67 bool fin,
69 FecProtection fec_protection,
70 QuicAckListenerInterface* ack_notifier_delegate) override { 68 QuicAckListenerInterface* ack_notifier_delegate) override {
71 if (!writable_) { 69 if (!writable_) {
72 return QuicConsumedData(0, false); 70 return QuicConsumedData(0, false);
73 } 71 }
74 72
75 const char* data = reinterpret_cast<const char*>(iovector.iov->iov_base); 73 const char* data = reinterpret_cast<const char*>(iovector.iov->iov_base);
76 size_t len = iovector.total_length; 74 size_t len = iovector.total_length;
77 write_buffer_->append(data, len); 75 write_buffer_->append(data, len);
78 return QuicConsumedData(len, false); 76 return QuicConsumedData(len, false);
79 } 77 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 bool writable_ = true; 109 bool writable_ = true;
112 }; 110 };
113 111
114 // Packet writer that does nothing. This is required for QuicConnection but 112 // Packet writer that does nothing. This is required for QuicConnection but
115 // isn't used for writing data. 113 // isn't used for writing data.
116 class DummyPacketWriter : public QuicPacketWriter { 114 class DummyPacketWriter : public QuicPacketWriter {
117 public: 115 public:
118 DummyPacketWriter() {} 116 DummyPacketWriter() {}
119 117
120 // QuicPacketWriter overrides. 118 // QuicPacketWriter overrides.
121 virtual net::WriteResult WritePacket(const char* buffer, 119 net::WriteResult WritePacket(const char* buffer,
122 size_t buf_len, 120 size_t buf_len,
123 const IPAddress& self_address, 121 const IPAddress& self_address,
124 const IPEndPoint& peer_address, 122 const IPEndPoint& peer_address,
125 PerPacketOptions* options) { 123 PerPacketOptions* options) override {
126 return net::WriteResult(net::WRITE_STATUS_ERROR, 0); 124 return net::WriteResult(net::WRITE_STATUS_ERROR, 0);
127 } 125 }
128 126
129 bool IsWriteBlockedDataBuffered() const override { return false; } 127 bool IsWriteBlockedDataBuffered() const override { return false; }
130 128
131 bool IsWriteBlocked() const override { return false; }; 129 bool IsWriteBlocked() const override { return false; };
132 130
133 void SetWritable() override {} 131 void SetWritable() override {}
134 132
135 net::QuicByteCount GetMaxPacketSize( 133 net::QuicByteCount GetMaxPacketSize(
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 EXPECT_EQ("Hello", read_buffer_); 248 EXPECT_EQ("Hello", read_buffer_);
251 } 249 }
252 250
253 // Test that closing the stream results in a callback. 251 // Test that closing the stream results in a callback.
254 TEST_F(ReliableQuicStreamTest, CloseStream) { 252 TEST_F(ReliableQuicStreamTest, CloseStream) {
255 CreateReliableQuicStream(); 253 CreateReliableQuicStream();
256 EXPECT_FALSE(closed_); 254 EXPECT_FALSE(closed_);
257 stream_->OnClose(); 255 stream_->OnClose();
258 EXPECT_TRUE(closed_); 256 EXPECT_TRUE(closed_);
259 } 257 }
OLDNEW
« no previous file with comments | « webrtc/p2p/quic/quictransportchannel.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698