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

Side by Side Diff: webrtc/pc/mediasession_unittest.cc

Issue 2902213002: Support "UDP/DTLS/SCTP" and "TCP/DTLS/SCTP" profile strings. (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2004 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 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 1001
1002 std::unique_ptr<SessionDescription> answer( 1002 std::unique_ptr<SessionDescription> answer(
1003 f2_.CreateAnswer(offer.get(), opts, NULL)); 1003 f2_.CreateAnswer(offer.get(), opts, NULL));
1004 const ContentInfo* dc_answer = answer->GetContentByName("data"); 1004 const ContentInfo* dc_answer = answer->GetContentByName("data");
1005 ASSERT_TRUE(dc_answer != NULL); 1005 ASSERT_TRUE(dc_answer != NULL);
1006 const DataContentDescription* dcd_answer = 1006 const DataContentDescription* dcd_answer =
1007 static_cast<const DataContentDescription*>(dc_answer->description); 1007 static_cast<const DataContentDescription*>(dc_answer->description);
1008 EXPECT_FALSE(dcd_answer->use_sctpmap()); 1008 EXPECT_FALSE(dcd_answer->use_sctpmap());
1009 } 1009 }
1010 1010
1011 // Test that a valid answer will be created for "DTLS/SCTP", "UDP/DTLS/SCTP"
1012 // and "TCP/DTLS/SCTP" offers.
1013 TEST_F(MediaSessionDescriptionFactoryTest,
1014 TestCreateDataAnswerToDifferentOfferedProtos) {
1015 // Need to enable DTLS offer/answer generation (disabled by default in this
1016 // test).
1017 f1_.set_secure(SEC_ENABLED);
1018 f2_.set_secure(SEC_ENABLED);
1019 tdf1_.set_secure(SEC_ENABLED);
1020 tdf2_.set_secure(SEC_ENABLED);
1021
1022 MediaSessionOptions opts;
1023 opts.data_channel_type = cricket::DCT_SCTP;
1024 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, nullptr));
1025 ASSERT_TRUE(offer.get() != nullptr);
1026 ContentInfo* dc_offer = offer->GetContentByName("data");
1027 ASSERT_TRUE(dc_offer != nullptr);
1028 DataContentDescription* dcd_offer =
1029 static_cast<DataContentDescription*>(dc_offer->description);
1030
1031 std::vector<std::string> protos = {"DTLS/SCTP", "UDP/DTLS/SCTP",
1032 "TCP/DTLS/SCTP"};
1033 for (const std::string& proto : protos) {
1034 dcd_offer->set_protocol(proto);
1035 std::unique_ptr<SessionDescription> answer(
1036 f2_.CreateAnswer(offer.get(), opts, nullptr));
1037 const ContentInfo* dc_answer = answer->GetContentByName("data");
1038 ASSERT_TRUE(dc_answer != nullptr);
1039 const DataContentDescription* dcd_answer =
1040 static_cast<const DataContentDescription*>(dc_answer->description);
1041 EXPECT_FALSE(dc_answer->rejected);
1042 EXPECT_EQ(proto, dcd_answer->protocol());
1043 }
1044 }
1045
1011 // Verifies that the order of the media contents in the offer is preserved in 1046 // Verifies that the order of the media contents in the offer is preserved in
1012 // the answer. 1047 // the answer.
1013 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAnswerContentOrder) { 1048 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAnswerContentOrder) {
1014 MediaSessionOptions opts; 1049 MediaSessionOptions opts;
1015 1050
1016 // Creates a data only offer. 1051 // Creates a data only offer.
1017 opts.recv_audio = false; 1052 opts.recv_audio = false;
1018 opts.data_channel_type = cricket::DCT_SCTP; 1053 opts.data_channel_type = cricket::DCT_SCTP;
1019 std::unique_ptr<SessionDescription> offer1(f1_.CreateOffer(opts, NULL)); 1054 std::unique_ptr<SessionDescription> offer1(f1_.CreateOffer(opts, NULL));
1020 ASSERT_TRUE(offer1.get() != NULL); 1055 ASSERT_TRUE(offer1.get() != NULL);
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after
3019 ::testing::Combine( 3054 ::testing::Combine(
3020 ::testing::Values(cricket::MD_SENDONLY, 3055 ::testing::Values(cricket::MD_SENDONLY,
3021 cricket::MD_RECVONLY, 3056 cricket::MD_RECVONLY,
3022 cricket::MD_SENDRECV, 3057 cricket::MD_SENDRECV,
3023 cricket::MD_INACTIVE), 3058 cricket::MD_INACTIVE),
3024 ::testing::Values(cricket::MD_SENDONLY, 3059 ::testing::Values(cricket::MD_SENDONLY,
3025 cricket::MD_RECVONLY, 3060 cricket::MD_RECVONLY,
3026 cricket::MD_SENDRECV, 3061 cricket::MD_SENDRECV,
3027 cricket::MD_INACTIVE), 3062 cricket::MD_INACTIVE),
3028 ::testing::Bool())); 3063 ::testing::Bool()));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698