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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 new FakeTransportChannel("channel1", 0)); | 288 new FakeTransportChannel("channel1", 0)); |
289 std::unique_ptr<FakeTransportChannel> channel2( | 289 std::unique_ptr<FakeTransportChannel> channel2( |
290 new FakeTransportChannel("channel2", 0)); | 290 new FakeTransportChannel("channel2", 0)); |
291 | 291 |
292 // Prevent channel1->OnReadPacket and channel2->OnReadPacket from calling | 292 // Prevent channel1->OnReadPacket and channel2->OnReadPacket from calling |
293 // themselves in a loop, which causes to future packets to be recursively | 293 // themselves in a loop, which causes to future packets to be recursively |
294 // consumed while the current thread blocks consumption of current ones. | 294 // consumed while the current thread blocks consumption of current ones. |
295 channel2->SetAsync(true); | 295 channel2->SetAsync(true); |
296 | 296 |
297 // Configure peers to send packets to each other. | 297 // Configure peers to send packets to each other. |
298 channel1->Connect(); | |
299 channel2->Connect(); | |
300 channel1->SetDestination(channel2.get()); | 298 channel1->SetDestination(channel2.get()); |
301 | 299 |
302 client_peer_ = CreateSession(std::move(channel1), Perspective::IS_CLIENT); | 300 client_peer_ = CreateSession(std::move(channel1), Perspective::IS_CLIENT); |
303 server_peer_ = CreateSession(std::move(channel2), Perspective::IS_SERVER); | 301 server_peer_ = CreateSession(std::move(channel2), Perspective::IS_SERVER); |
304 } | 302 } |
305 | 303 |
306 std::unique_ptr<QuicSessionForTest> QuicSessionTest::CreateSession( | 304 std::unique_ptr<QuicSessionForTest> QuicSessionTest::CreateSession( |
307 std::unique_ptr<FakeTransportChannel> channel, | 305 std::unique_ptr<FakeTransportChannel> channel, |
308 Perspective perspective) { | 306 Perspective perspective) { |
309 std::unique_ptr<QuicConnection> quic_connection = | 307 std::unique_ptr<QuicConnection> quic_connection = |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 StartHandshake(true, true); | 467 StartHandshake(true, true); |
470 ASSERT_TRUE_WAIT(client_peer_->IsCryptoHandshakeConfirmed() && | 468 ASSERT_TRUE_WAIT(client_peer_->IsCryptoHandshakeConfirmed() && |
471 server_peer_->IsCryptoHandshakeConfirmed(), | 469 server_peer_->IsCryptoHandshakeConfirmed(), |
472 kTimeoutMs); | 470 kTimeoutMs); |
473 ReliableQuicStream* stream = client_peer_->CreateOutgoingDynamicStream(5); | 471 ReliableQuicStream* stream = client_peer_->CreateOutgoingDynamicStream(5); |
474 ASSERT_NE(nullptr, stream); | 472 ASSERT_NE(nullptr, stream); |
475 EXPECT_FALSE(client_peer_->IsClosedStream(stream->id())); | 473 EXPECT_FALSE(client_peer_->IsClosedStream(stream->id())); |
476 stream->Close(); | 474 stream->Close(); |
477 EXPECT_TRUE(client_peer_->IsClosedStream(stream->id())); | 475 EXPECT_TRUE(client_peer_->IsClosedStream(stream->id())); |
478 } | 476 } |
OLD | NEW |