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

Side by Side Diff: webrtc/api/objctests/RTCSessionDescriptionTest.mm

Issue 1524303006: Update API for Objective-C RTCSessionDescription. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@updateRTCIceCandidate
Patch Set: Updates based on feedback Created 4 years, 11 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
(Empty)
1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #import <Foundation/Foundation.h>
12
13 #include "webrtc/base/gunit.h"
14
15 #import "webrtc/api/objc/RTCSessionDescription.h"
16 #import "webrtc/api/objc/RTCSessionDescription+Private.h"
17 #import "webrtc/base/objc/NSString+StdString.h"
18
19 @interface RTCSessionDescriptionTest : NSObject
20 - (void)testSessionDescriptionConversion;
21 - (void)testInitFromNativeSessionDescription;
22 @end
23
24 @implementation RTCSessionDescriptionTest
25
26 /**
27 * Test conversion of an Objective-C RTCSessionDescription to a native
28 * SessionDescriptionInterface (based on the types and SDP strings being equal).
29 */
30 - (void)testSessionDescriptionConversion {
31 RTCSessionDescription *description =
32 [[RTCSessionDescription alloc] initWithType:RTCSdpTypeAnswer
33 sdp:[self sdp]];
34
35 webrtc::SessionDescriptionInterface *nativeDescription =
36 description.nativeDescription;
37
38 NSString *typeString =
39 [NSString stringForStdString:nativeDescription->type()];
40 EXPECT_EQ(RTCSdpTypeAnswer, [RTCSessionDescription typeForString:typeString]);
41
42 std::string sdp;
43 nativeDescription->ToString(&sdp);
44 EXPECT_EQ([self sdp].stdString, sdp);
45 }
46
47 - (void)testInitFromNativeSessionDescription {
48 webrtc::SessionDescriptionInterface *nativeDescription;
49
50 nativeDescription = webrtc::CreateSessionDescription(
51 webrtc::SessionDescriptionInterface::kAnswer,
52 [self sdp].stdString,
53 nullptr);
54
55 RTCSessionDescription *description =
56 [[RTCSessionDescription alloc] initWithNativeDescription:
57 nativeDescription];
58 NSString *typeString = [RTCSessionDescription stringForType:description.type];
59 EXPECT_EQ(webrtc::SessionDescriptionInterface::kAnswer, typeString.stdString);
60 EXPECT_TRUE([[self sdp] isEqualToString:description.sdp]);
61 }
62
63 - (NSString *)sdp {
64 return @"v=0\r\n"
65 "o=- 5319989746393411314 2 IN IP4 127.0.0.1\r\n"
66 "s=-\r\n"
67 "t=0 0\r\n"
68 "a=group:BUNDLE audio video\r\n"
69 "a=msid-semantic: WMS ARDAMS\r\n"
70 "m=audio 9 UDP/TLS/RTP/SAVPF 111 103 9 0 8 126\r\n"
71 "c=IN IP4 0.0.0.0\r\n"
72 "a=rtcp:9 IN IP4 0.0.0.0\r\n"
73 "a=ice-ufrag:f3o+0HG7l9nwIWFY\r\n"
74 "a=ice-pwd:VDctmJNCptR2TB7+meDpw7w5\r\n"
75 "a=fingerprint:sha-256 A9:D5:8D:A8:69:22:39:60:92:AD:94:1A:22:2D:5E:"
76 "A5:4A:A9:18:C2:35:5D:46:5E:59:BD:1C:AF:38:9F:E6:E1\r\n"
77 "a=setup:active\r\n"
78 "a=mid:audio\r\n"
79 "a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\n"
80 "a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/"
81 "abs-send-time\r\n"
82 "a=sendrecv\r\n"
83 "a=rtcp-mux\r\n"
84 "a=rtpmap:111 opus/48000/2\r\n"
85 "a=fmtp:111 minptime=10; useinbandfec=1\r\n"
86 "a=rtpmap:103 ISAC/16000\r\n"
87 "a=rtpmap:9 G722/8000\r\n"
88 "a=rtpmap:0 PCMU/8000\r\n"
89 "a=rtpmap:8 PCMA/8000\r\n"
90 "a=rtpmap:126 telephone-event/8000\r\n"
91 "a=maxptime:60\r\n"
92 "a=ssrc:1504474588 cname:V+FdIC5AJpxLhdYQ\r\n"
93 "a=ssrc:1504474588 msid:ARDAMS ARDAMSa0\r\n"
94 "a=ssrc:1504474588 mslabel:ARDAMS\r\n"
95 "a=ssrc:1504474588 label:ARDAMSa0\r\n"
96 "m=video 9 UDP/TLS/RTP/SAVPF 100 116 117 96\r\n"
97 "c=IN IP4 0.0.0.0\r\n"
98 "a=rtcp:9 IN IP4 0.0.0.0\r\n"
99 "a=ice-ufrag:f3o+0HG7l9nwIWFY\r\n"
100 "a=ice-pwd:VDctmJNCptR2TB7+meDpw7w5\r\n"
101 "a=fingerprint:sha-256 A9:D5:8D:A8:69:22:39:60:92:AD:94:1A:22:2D:5E:"
102 "A5:4A:A9:18:C2:35:5D:46:5E:59:BD:1C:AF:38:9F:E6:E1\r\n"
103 "a=setup:active\r\n"
104 "a=mid:video\r\n"
105 "a=extmap:2 urn:ietf:params:rtp-hdrext:toffset\r\n"
106 "a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/"
107 "abs-send-time\r\n"
108 "a=extmap:4 urn:3gpp:video-orientation\r\n"
109 "a=sendrecv\r\n"
110 "a=rtcp-mux\r\n"
111 "a=rtpmap:100 VP8/90000\r\n"
112 "a=rtcp-fb:100 ccm fir\r\n"
113 "a=rtcp-fb:100 nack\r\n"
114 "a=rtcp-fb:100 nack pli\r\n"
115 "a=rtcp-fb:100 goog-remb\r\n"
116 "a=rtpmap:116 red/90000\r\n"
117 "a=rtpmap:117 ulpfec/90000\r\n"
118 "a=rtpmap:96 rtx/90000\r\n"
119 "a=fmtp:96 apt=100\r\n"
120 "a=ssrc-group:FID 498297514 1644357692\r\n"
121 "a=ssrc:498297514 cname:V+FdIC5AJpxLhdYQ\r\n"
122 "a=ssrc:498297514 msid:ARDAMS ARDAMSv0\r\n"
123 "a=ssrc:498297514 mslabel:ARDAMS\r\n"
124 "a=ssrc:498297514 label:ARDAMSv0\r\n"
125 "a=ssrc:1644357692 cname:V+FdIC5AJpxLhdYQ\r\n"
126 "a=ssrc:1644357692 msid:ARDAMS ARDAMSv0\r\n"
127 "a=ssrc:1644357692 mslabel:ARDAMS\r\n"
128 "a=ssrc:1644357692 label:ARDAMSv0\r\n";
129 }
130
131 @end
132
133 TEST(RTCSessionDescriptionTest, SessionDescriptionConversionTest) {
134 @autoreleasepool {
135 RTCSessionDescriptionTest *test = [[RTCSessionDescriptionTest alloc] init];
136 [test testSessionDescriptionConversion];
137 }
138 }
139
140 TEST(RTCSessionDescriptionTest, InitFromSessionDescriptionTest) {
141 @autoreleasepool {
142 RTCSessionDescriptionTest *test = [[RTCSessionDescriptionTest alloc] init];
143 [test testInitFromNativeSessionDescription];
144 }
145 }
OLDNEW
« webrtc/api/objc/RTCSessionDescription.mm ('K') | « webrtc/api/objc/RTCSessionDescription+Private.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698