OLD | NEW |
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 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 stream_->SignalClosed.connect(this, &ReliableQuicStreamTest::OnClosed); | 165 stream_->SignalClosed.connect(this, &ReliableQuicStreamTest::OnClosed); |
166 | 166 |
167 session_->register_write_blocked_stream(stream_->id(), kDefaultPriority); | 167 session_->register_write_blocked_stream(stream_->id(), kDefaultPriority); |
168 } | 168 } |
169 | 169 |
170 void OnDataReceived(QuicStreamId id, const char* data, size_t length) { | 170 void OnDataReceived(QuicStreamId id, const char* data, size_t length) { |
171 ASSERT_EQ(id, stream_->id()); | 171 ASSERT_EQ(id, stream_->id()); |
172 read_buffer_.append(data, length); | 172 read_buffer_.append(data, length); |
173 } | 173 } |
174 | 174 |
175 void OnClosed(QuicStreamId id, QuicErrorCode err) { closed_ = true; } | 175 void OnClosed(QuicStreamId id, int err) { closed_ = true; } |
176 | 176 |
177 protected: | 177 protected: |
178 rtc::scoped_ptr<ReliableQuicStream> stream_; | 178 rtc::scoped_ptr<ReliableQuicStream> stream_; |
179 rtc::scoped_ptr<MockQuicSession> session_; | 179 rtc::scoped_ptr<MockQuicSession> session_; |
180 | 180 |
181 // Data written by the ReliableQuicStream. | 181 // Data written by the ReliableQuicStream. |
182 std::string write_buffer_; | 182 std::string write_buffer_; |
183 // Data read by the ReliableQuicStream. | 183 // Data read by the ReliableQuicStream. |
184 std::string read_buffer_; | 184 std::string read_buffer_; |
185 // Whether the ReliableQuicStream is closed. | 185 // Whether the ReliableQuicStream is closed. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 EXPECT_EQ("Hello", read_buffer_); | 240 EXPECT_EQ("Hello", read_buffer_); |
241 } | 241 } |
242 | 242 |
243 // Test that closing the stream results in a callback. | 243 // Test that closing the stream results in a callback. |
244 TEST_F(ReliableQuicStreamTest, CloseStream) { | 244 TEST_F(ReliableQuicStreamTest, CloseStream) { |
245 CreateReliableQuicStream(); | 245 CreateReliableQuicStream(); |
246 EXPECT_FALSE(closed_); | 246 EXPECT_FALSE(closed_); |
247 stream_->OnClose(); | 247 stream_->OnClose(); |
248 EXPECT_TRUE(closed_); | 248 EXPECT_TRUE(closed_); |
249 } | 249 } |
OLD | NEW |