| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/protocol/sdp_message.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 |
| 9 namespace remoting { |
| 10 namespace protocol { |
| 11 |
| 12 // Verify that SDP is normalized by removing empty lines and normalizing |
| 13 // line-endings to \n. |
| 14 TEST(SdpMessages, Normalize) { |
| 15 SdpMessage sdp_message("a=foo\n\r\nb=bar"); |
| 16 EXPECT_EQ("a=foo\nb=bar\n", sdp_message.ToString()); |
| 17 } |
| 18 |
| 19 TEST(SdpMessages, AddCodecParameter) { |
| 20 std::string kSourceSdp = |
| 21 "a=group:BUNDLE video\n" |
| 22 "m=video 9 UDP/TLS/RTP/SAVPF 96\n" |
| 23 "a=rtpmap:96 VP8/90000\n" |
| 24 "a=rtcp-fb:96 transport-cc\n"; |
| 25 SdpMessage sdp_message(kSourceSdp); |
| 26 EXPECT_TRUE(sdp_message.AddCodecParameter("VP8", "test_param=1")); |
| 27 EXPECT_EQ( |
| 28 "a=group:BUNDLE video\n" |
| 29 "m=video 9 UDP/TLS/RTP/SAVPF 96\n" |
| 30 "a=rtpmap:96 VP8/90000\n" |
| 31 "a=fmtp:96 test_param=1\n" |
| 32 "a=rtcp-fb:96 transport-cc\n", |
| 33 sdp_message.ToString()); |
| 34 } |
| 35 |
| 36 TEST(SdpMessages, AddCodecParameterMissingCodec) { |
| 37 std::string kSourceSdp = |
| 38 "a=group:BUNDLE audio video\n" |
| 39 "m=audio 9 UDP/TLS/RTP/SAVPF 111\n" |
| 40 "a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\n" |
| 41 "a=rtpmap:111 opus/48000/2\n" |
| 42 "a=rtcp-fb:111 transport-cc\n" |
| 43 "m=video 9 UDP/TLS/RTP/SAVPF 96\n" |
| 44 "a=rtpmap:96 VP9/90000\n" |
| 45 "a=rtcp-fb:96 transport-cc\n" |
| 46 "m=application 9 DTLS/SCTP 5000\n"; |
| 47 SdpMessage sdp_message(kSourceSdp); |
| 48 EXPECT_FALSE(sdp_message.AddCodecParameter("VP8", "test_param=1")); |
| 49 EXPECT_EQ(kSourceSdp, sdp_message.ToString()); |
| 50 } |
| 51 |
| 52 } // namespace protocol |
| 53 } // namespace remoting |
| OLD | NEW |