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

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

Issue 2146133002: Revert of Modify PeerConnection for end-to-end QuicDataChannel usage (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 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') | webrtc/p2p/quic/reliablequicstream_unittest.cc » ('j') | 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
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 ice_channel_->SetAsync(true); 105 ice_channel_->SetAsync(true);
106 rtc::scoped_refptr<rtc::RTCCertificate> local_cert = 106 rtc::scoped_refptr<rtc::RTCCertificate> local_cert =
107 rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>( 107 rtc::RTCCertificate::Create(std::unique_ptr<rtc::SSLIdentity>(
108 rtc::SSLIdentity::Generate(name_, rtc::KT_DEFAULT))); 108 rtc::SSLIdentity::Generate(name_, rtc::KT_DEFAULT)));
109 quic_channel_.SetLocalCertificate(local_cert); 109 quic_channel_.SetLocalCertificate(local_cert);
110 local_fingerprint_.reset(CreateFingerprint(local_cert.get())); 110 local_fingerprint_.reset(CreateFingerprint(local_cert.get()));
111 } 111 }
112 112
113 // Connects |ice_channel_| to that of the other peer. 113 // Connects |ice_channel_| to that of the other peer.
114 void Connect(QuicTestPeer* other_peer) { 114 void Connect(QuicTestPeer* other_peer) {
115 ice_channel_->Connect();
116 other_peer->ice_channel_->Connect();
115 ice_channel_->SetDestination(other_peer->ice_channel_); 117 ice_channel_->SetDestination(other_peer->ice_channel_);
116 } 118 }
117 119
118 // Disconnects |ice_channel_|. 120 // Disconnects |ice_channel_|.
119 void Disconnect() { ice_channel_->SetDestination(nullptr); } 121 void Disconnect() { ice_channel_->SetDestination(nullptr); }
120 122
121 // Generates ICE credentials and passes them to |quic_channel_|. 123 // Generates ICE credentials and passes them to |quic_channel_|.
122 void SetIceParameters(IceRole local_ice_role, 124 void SetIceParameters(IceRole local_ice_role,
123 ConnectionRole local_connection_role, 125 ConnectionRole local_connection_role,
124 ConnectionRole remote_connection_role, 126 ConnectionRole remote_connection_role,
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 Connect(); 412 Connect();
411 peer1_.ClearBytesSent(); 413 peer1_.ClearBytesSent();
412 peer2_.ClearBytesReceived(); 414 peer2_.ClearBytesReceived();
413 EXPECT_EQ(-1, peer1_.SendInvalidSrtpPacket()); 415 EXPECT_EQ(-1, peer1_.SendInvalidSrtpPacket());
414 EXPECT_EQ(0u, peer2_.bytes_received()); 416 EXPECT_EQ(0u, peer2_.bytes_received());
415 } 417 }
416 418
417 // Test that QuicTransportChannel::WritePacket blocks when the ICE 419 // Test that QuicTransportChannel::WritePacket blocks when the ICE
418 // channel is not writable, and otherwise succeeds. 420 // channel is not writable, and otherwise succeeds.
419 TEST_F(QuicTransportChannelTest, QuicWritePacket) { 421 TEST_F(QuicTransportChannelTest, QuicWritePacket) {
422 peer1_.ice_channel()->Connect();
423 peer2_.ice_channel()->Connect();
420 peer1_.ice_channel()->SetDestination(peer2_.ice_channel()); 424 peer1_.ice_channel()->SetDestination(peer2_.ice_channel());
421 std::string packet = "FAKEQUICPACKET"; 425 std::string packet = "FAKEQUICPACKET";
422 426
423 // QUIC should be write blocked when the ICE channel is not writable. 427 // QUIC should be write blocked when the ICE channel is not writable.
424 peer1_.ice_channel()->SetWritable(false); 428 peer1_.ice_channel()->SetWritable(false);
425 EXPECT_TRUE(peer1_.quic_channel()->IsWriteBlocked()); 429 EXPECT_TRUE(peer1_.quic_channel()->IsWriteBlocked());
426 net::WriteResult write_blocked_result = peer1_.quic_channel()->WritePacket( 430 net::WriteResult write_blocked_result = peer1_.quic_channel()->WritePacket(
427 packet.data(), packet.size(), kIpAddress, kIpEndpoint, nullptr); 431 packet.data(), packet.size(), kIpAddress, kIpEndpoint, nullptr);
428 EXPECT_EQ(net::WRITE_STATUS_BLOCKED, write_blocked_result.status); 432 EXPECT_EQ(net::WRITE_STATUS_BLOCKED, write_blocked_result.status);
429 EXPECT_EQ(EWOULDBLOCK, write_blocked_result.error_code); 433 EXPECT_EQ(EWOULDBLOCK, write_blocked_result.error_code);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 Connect(); 547 Connect();
544 ASSERT_TRUE_WAIT(quic_connected(), kTimeoutMs); 548 ASSERT_TRUE_WAIT(quic_connected(), kTimeoutMs);
545 ASSERT_FALSE(peer1_.signal_closed_emitted()); 549 ASSERT_FALSE(peer1_.signal_closed_emitted());
546 ReliableQuicStream* stream = peer1_.quic_channel()->CreateQuicStream(); 550 ReliableQuicStream* stream = peer1_.quic_channel()->CreateQuicStream();
547 ASSERT_NE(nullptr, stream); 551 ASSERT_NE(nullptr, stream);
548 stream->CloseConnectionWithDetails(net::QuicErrorCode::QUIC_NO_ERROR, 552 stream->CloseConnectionWithDetails(net::QuicErrorCode::QUIC_NO_ERROR,
549 "Closing QUIC for testing"); 553 "Closing QUIC for testing");
550 EXPECT_TRUE(peer1_.signal_closed_emitted()); 554 EXPECT_TRUE(peer1_.signal_closed_emitted());
551 EXPECT_TRUE_WAIT(peer2_.signal_closed_emitted(), kTimeoutMs); 555 EXPECT_TRUE_WAIT(peer2_.signal_closed_emitted(), kTimeoutMs);
552 } 556 }
OLDNEW
« no previous file with comments | « webrtc/p2p/quic/quictransportchannel.cc ('k') | webrtc/p2p/quic/reliablequicstream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698