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

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

Issue 1903663002: Build dynamic iOS SDK. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix test gyp Created 4 years, 7 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/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 "
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 "
47 "fdff:2642:12a6:fe38:c001:beda:fcf9:51aa "
48 "59052 typ host generation 0");
49 webrtc::IceCandidateInterface *nativeCandidate =
50 webrtc::CreateIceCandidate("audio", 0, sdp, nullptr);
51
52 RTCIceCandidate *iceCandidate =
53 [[RTCIceCandidate alloc] initWithNativeCandidate:nativeCandidate];
54 EXPECT_TRUE([@"audio" isEqualToString:iceCandidate.sdpMid]);
55 EXPECT_EQ(0, iceCandidate.sdpMLineIndex);
56
57 EXPECT_EQ(sdp, iceCandidate.sdp.stdString);
58 }
59
60 @end
61
62 TEST(RTCIceCandidateTest, CandidateTest) {
63 @autoreleasepool {
64 RTCIceCandidateTest *test = [[RTCIceCandidateTest alloc] init];
65 [test testCandidate];
66 }
67 }
68
69 TEST(RTCIceCandidateTest, InitFromCandidateTest) {
70 @autoreleasepool {
71 RTCIceCandidateTest *test = [[RTCIceCandidateTest alloc] init];
72 [test testInitFromNativeCandidate];
73 }
74 }
OLDNEW
« no previous file with comments | « webrtc/api/objctests/RTCDataChannelConfigurationTest.mm ('k') | webrtc/api/objctests/RTCIceServerTest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698