Chromium Code Reviews

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

Issue 2690943011: Use the same draft version in SDP data channel answers as used in the offer. (Closed)
Patch Set: Fixing up style issues and adding some mediasession tests. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « webrtc/pc/mediasession.cc ('k') | webrtc/pc/webrtcsdp.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 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 951 matching lines...)
962 EXPECT_TRUE(acd->rtcp_mux()); // negotiated rtcp-mux 962 EXPECT_TRUE(acd->rtcp_mux()); // negotiated rtcp-mux
963 ASSERT_CRYPTO(acd, 1U, CS_AEAD_AES_256_GCM); 963 ASSERT_CRYPTO(acd, 1U, CS_AEAD_AES_256_GCM);
964 EXPECT_EQ(MEDIA_TYPE_DATA, vcd->type()); 964 EXPECT_EQ(MEDIA_TYPE_DATA, vcd->type());
965 EXPECT_EQ(MAKE_VECTOR(kDataCodecsAnswer), vcd->codecs()); 965 EXPECT_EQ(MAKE_VECTOR(kDataCodecsAnswer), vcd->codecs());
966 EXPECT_NE(0U, vcd->first_ssrc()); // a random nonzero ssrc 966 EXPECT_NE(0U, vcd->first_ssrc()); // a random nonzero ssrc
967 EXPECT_TRUE(vcd->rtcp_mux()); // negotiated rtcp-mux 967 EXPECT_TRUE(vcd->rtcp_mux()); // negotiated rtcp-mux
968 ASSERT_CRYPTO(vcd, 1U, CS_AEAD_AES_256_GCM); 968 ASSERT_CRYPTO(vcd, 1U, CS_AEAD_AES_256_GCM);
969 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), vcd->protocol()); 969 EXPECT_EQ(std::string(cricket::kMediaProtocolSavpf), vcd->protocol());
970 } 970 }
971 971
972 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateDataAnswerUsesSctpmap) {
Taylor Brandstetter 2017/02/17 22:15:35 Could you leave a comment above these two tests de
Zach Stein 2017/02/17 22:55:28 Done.
973 MediaSessionOptions opts;
974 opts.data_channel_type = cricket::DCT_SCTP;
975 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
Taylor Brandstetter 2017/02/17 22:15:35 We use C++11 "nullptr" instead of "NULL". Though d
Zach Stein 2017/02/17 22:55:28 I'll match the rest of the file for now.
976 ASSERT_TRUE(offer.get() != NULL);
977 ContentInfo* offer_dv = offer->GetContentByName("data");
Taylor Brandstetter 2017/02/17 22:15:35 What does "dv" stand for? I'd suggest more descri
Zach Stein 2017/02/17 22:55:28 I meant for this to be dc for data content - I'll
978 ASSERT_TRUE(offer_dv != NULL);
979 DataContentDescription* offer_dvd =
980 static_cast<DataContentDescription*>(offer_dv->description);
981 EXPECT_TRUE(offer_dvd->use_sctpmap());
982
983 std::unique_ptr<SessionDescription> answer(
984 f2_.CreateAnswer(offer.get(), opts, NULL));
985 const ContentInfo* answer_dv = answer->GetContentByName("data");
986 ASSERT_TRUE(answer_dv != NULL);
987 const DataContentDescription* answer_dvd =
988 static_cast<const DataContentDescription*>(answer_dv->description);
989 EXPECT_TRUE(answer_dvd->use_sctpmap());
990 }
991
992 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateDataAnswerWithoutSctpmap) {
993 MediaSessionOptions opts;
994 opts.data_channel_type = cricket::DCT_SCTP;
995 std::unique_ptr<SessionDescription> offer(f1_.CreateOffer(opts, NULL));
996 ASSERT_TRUE(offer.get() != NULL);
997 ContentInfo* offer_dv = offer->GetContentByName("data");
998 ASSERT_TRUE(offer_dv != NULL);
999 DataContentDescription* offer_dvd =
1000 static_cast<DataContentDescription*>(offer_dv->description);
1001 offer_dvd->set_use_sctpmap(false);
1002
1003 std::unique_ptr<SessionDescription> answer(
1004 f2_.CreateAnswer(offer.get(), opts, NULL));
1005 const ContentInfo* answer_dv = answer->GetContentByName("data");
1006 ASSERT_TRUE(answer_dv != NULL);
1007 const DataContentDescription* answer_dvd =
1008 static_cast<const DataContentDescription*>(answer_dv->description);
1009 EXPECT_FALSE(answer_dvd->use_sctpmap());
1010 }
1011
972 // Verifies that the order of the media contents in the offer is preserved in 1012 // Verifies that the order of the media contents in the offer is preserved in
973 // the answer. 1013 // the answer.
974 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAnswerContentOrder) { 1014 TEST_F(MediaSessionDescriptionFactoryTest, TestCreateAnswerContentOrder) {
975 MediaSessionOptions opts; 1015 MediaSessionOptions opts;
976 1016
977 // Creates a data only offer. 1017 // Creates a data only offer.
978 opts.recv_audio = false; 1018 opts.recv_audio = false;
979 opts.data_channel_type = cricket::DCT_SCTP; 1019 opts.data_channel_type = cricket::DCT_SCTP;
980 std::unique_ptr<SessionDescription> offer1(f1_.CreateOffer(opts, NULL)); 1020 std::unique_ptr<SessionDescription> offer1(f1_.CreateOffer(opts, NULL));
981 ASSERT_TRUE(offer1.get() != NULL); 1021 ASSERT_TRUE(offer1.get() != NULL);
(...skipping 1998 matching lines...)
2980 ::testing::Combine( 3020 ::testing::Combine(
2981 ::testing::Values(cricket::MD_SENDONLY, 3021 ::testing::Values(cricket::MD_SENDONLY,
2982 cricket::MD_RECVONLY, 3022 cricket::MD_RECVONLY,
2983 cricket::MD_SENDRECV, 3023 cricket::MD_SENDRECV,
2984 cricket::MD_INACTIVE), 3024 cricket::MD_INACTIVE),
2985 ::testing::Values(cricket::MD_SENDONLY, 3025 ::testing::Values(cricket::MD_SENDONLY,
2986 cricket::MD_RECVONLY, 3026 cricket::MD_RECVONLY,
2987 cricket::MD_SENDRECV, 3027 cricket::MD_SENDRECV,
2988 cricket::MD_INACTIVE), 3028 cricket::MD_INACTIVE),
2989 ::testing::Bool())); 3029 ::testing::Bool()));
OLDNEW
« no previous file with comments | « webrtc/pc/mediasession.cc ('k') | webrtc/pc/webrtcsdp.cc » ('j') | no next file with comments »

Powered by Google App Engine