OLD | NEW |
---|---|
(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/RTCIceCandidate.h" | |
16 #import "webrtc/api/objc/RTCIceCandidate+Private.h" | |
17 #import "webrtc/base/objc/NSString+StdString.h" | |
18 | |
19 @interface RTCIceCandidateTest : NSObject | |
20 - (void)testCandidate; | |
21 - (void)testInitFromNativeCandidate; | |
22 @end | |
23 | |
24 @implementation RTCIceCandidateTest | |
25 | |
26 - (void)testCandidate { | |
27 NSString *sdp = @"candidate:4025901590 1 udp 2122265343 " | |
28 "fdff:2642:12a6:fe38:c001:beda:fcf9:51aa " | |
tkchin_webrtc
2016/01/05 16:18:07
align "
hjon
2016/01/05 18:34:17
Done.
| |
29 "59052 typ host generation 0"; | |
30 | |
31 RTCIceCandidate *candidate = [[RTCIceCandidate alloc] initWithSdp:sdp | |
32 sdpMLineIndex:0 | |
33 sdpMid:@"audio"]; | |
34 | |
35 rtc::scoped_ptr<webrtc::IceCandidateInterface> nativeCandidate = | |
36 candidate.nativeCandidate; | |
37 EXPECT_EQ("audio", nativeCandidate->sdp_mid()); | |
38 EXPECT_EQ(0, nativeCandidate->sdp_mline_index()); | |
39 | |
40 std::string sdpString; | |
41 nativeCandidate->ToString(&sdpString); | |
42 EXPECT_EQ(sdp.stdString, sdpString); | |
43 } | |
44 | |
45 - (void)testInitFromNativeCandidate { | |
46 std::string sdp = "candidate:4025901590 1 udp 2122265343 " | |
tkchin_webrtc
2016/01/05 16:18:07
nit: std::string sdp("candidate...");
hjon
2016/01/05 18:34:17
Done.
| |
47 "fdff:2642:12a6:fe38:c001:beda:fcf9:51aa " | |
48 "59052 typ host generation 0"; | |
49 webrtc::IceCandidateInterface *nativeCandidate; | |
50 | |
51 nativeCandidate = webrtc::CreateIceCandidate("audio", 0, sdp, nullptr); | |
tkchin_webrtc
2016/01/05 16:18:07
combine 49 and 51
hjon
2016/01/05 18:34:17
Done.
| |
52 | |
53 RTCIceCandidate *iceCandidate = [[RTCIceCandidate alloc] initWithCandidate: | |
tkchin_webrtc
2016/01/05 16:18:07
break after = instead
hjon
2016/01/05 18:34:17
Done.
| |
54 nativeCandidate]; | |
55 EXPECT_TRUE([@"audio" isEqualToString:iceCandidate.sdpMid]); | |
56 EXPECT_EQ(0, iceCandidate.sdpMLineIndex); | |
57 | |
58 EXPECT_EQ(sdp, iceCandidate.sdp.stdString); | |
59 } | |
60 | |
61 @end | |
62 | |
63 TEST(RTCIceCandidateTest, CandidateTest) { | |
64 @autoreleasepool { | |
65 RTCIceCandidateTest *test = [[RTCIceCandidateTest alloc] init]; | |
66 [test testCandidate]; | |
67 } | |
68 } | |
69 | |
70 TEST(RTCIceCandidateTest, InitFromCandidateTest) { | |
71 @autoreleasepool { | |
72 RTCIceCandidateTest *test = [[RTCIceCandidateTest alloc] init]; | |
73 [test testInitFromNativeCandidate]; | |
74 } | |
75 } | |
OLD | NEW |