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

Side by Side Diff: webrtc/p2p/base/transportcontroller_unittest.cc

Issue 2517883002: Refactoring that removes P2PTransport and DtlsTransport classes. (Closed)
Patch Set: Adding stub transport.h file for backwards compat. Created 4 years 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/base/transportcontroller.cc ('k') | webrtc/p2p/client/socketmonitor.h » ('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 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 742
743 // The endpoint that initiated an ICE restart should keep the existing role. 743 // The endpoint that initiated an ICE restart should keep the existing role.
744 TransportDescription ice_restart_desc(std::vector<std::string>(), kIceUfrag3, 744 TransportDescription ice_restart_desc(std::vector<std::string>(), kIceUfrag3,
745 kIcePwd3, ICEMODE_FULL, 745 kIcePwd3, ICEMODE_FULL,
746 CONNECTIONROLE_ACTPASS, nullptr); 746 CONNECTIONROLE_ACTPASS, nullptr);
747 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( 747 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription(
748 "audio", ice_restart_desc, CA_OFFER, &err)); 748 "audio", ice_restart_desc, CA_OFFER, &err));
749 EXPECT_EQ(ICEROLE_CONTROLLED, channel->GetIceRole()); 749 EXPECT_EQ(ICEROLE_CONTROLLED, channel->GetIceRole());
750 } 750 }
751 751
752 // Tests channel role is reversed after receiving ice-lite from remote.
753 TEST_F(TransportControllerTest, TestSetRemoteIceLiteInOffer) {
754 FakeTransportChannel* channel = CreateChannel("audio", 1);
755 ASSERT_NE(nullptr, channel);
756 std::string err;
757
758 transport_controller_->SetIceRole(ICEROLE_CONTROLLED);
759 TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1,
760 kIcePwd1, ICEMODE_LITE,
761 CONNECTIONROLE_ACTPASS, nullptr);
762 EXPECT_TRUE(transport_controller_->SetRemoteTransportDescription(
763 "audio", remote_desc, CA_OFFER, &err));
764 TransportDescription local_desc(kIceUfrag1, kIcePwd1);
765 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription(
766 "audio", local_desc, CA_ANSWER, nullptr));
767
768 EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole());
769 EXPECT_EQ(ICEMODE_LITE, channel->remote_ice_mode());
770 }
771
772 // Tests ice-lite in remote answer.
773 TEST_F(TransportControllerTest, TestSetRemoteIceLiteInAnswer) {
774 FakeTransportChannel* channel = CreateChannel("audio", 1);
775 ASSERT_NE(nullptr, channel);
776 std::string err;
777
778 transport_controller_->SetIceRole(ICEROLE_CONTROLLING);
779 TransportDescription local_desc(kIceUfrag1, kIcePwd1);
780 ASSERT_TRUE(transport_controller_->SetLocalTransportDescription(
781 "audio", local_desc, CA_OFFER, nullptr));
782 EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole());
783 // Channels will be created in ICEFULL_MODE.
784 EXPECT_EQ(ICEMODE_FULL, channel->remote_ice_mode());
785 TransportDescription remote_desc(std::vector<std::string>(), kIceUfrag1,
786 kIcePwd1, ICEMODE_LITE, CONNECTIONROLE_NONE,
787 nullptr);
788 ASSERT_TRUE(transport_controller_->SetRemoteTransportDescription(
789 "audio", remote_desc, CA_ANSWER, nullptr));
790 EXPECT_EQ(ICEROLE_CONTROLLING, channel->GetIceRole());
791 // After receiving remote description with ICEMODE_LITE, channel should
792 // have mode set to ICEMODE_LITE.
793 EXPECT_EQ(ICEMODE_LITE, channel->remote_ice_mode());
794 }
795
752 } // namespace cricket { 796 } // namespace cricket {
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transportcontroller.cc ('k') | webrtc/p2p/client/socketmonitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698