| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 |
| 11 #import <Foundation/Foundation.h> | 11 #import <Foundation/Foundation.h> |
| 12 | 12 |
| 13 #include <memory> |
| 14 |
| 13 #include "webrtc/base/gunit.h" | 15 #include "webrtc/base/gunit.h" |
| 14 | 16 |
| 15 #import "NSString+StdString.h" | 17 #import "NSString+StdString.h" |
| 16 #import "RTCIceCandidate+Private.h" | 18 #import "RTCIceCandidate+Private.h" |
| 17 #import "WebRTC/RTCIceCandidate.h" | 19 #import "WebRTC/RTCIceCandidate.h" |
| 18 | 20 |
| 19 @interface RTCIceCandidateTest : NSObject | 21 @interface RTCIceCandidateTest : NSObject |
| 20 - (void)testCandidate; | 22 - (void)testCandidate; |
| 21 - (void)testInitFromNativeCandidate; | 23 - (void)testInitFromNativeCandidate; |
| 22 @end | 24 @end |
| 23 | 25 |
| 24 @implementation RTCIceCandidateTest | 26 @implementation RTCIceCandidateTest |
| 25 | 27 |
| 26 - (void)testCandidate { | 28 - (void)testCandidate { |
| 27 NSString *sdp = @"candidate:4025901590 1 udp 2122265343 " | 29 NSString *sdp = @"candidate:4025901590 1 udp 2122265343 " |
| 28 "fdff:2642:12a6:fe38:c001:beda:fcf9:51aa " | 30 "fdff:2642:12a6:fe38:c001:beda:fcf9:51aa " |
| 29 "59052 typ host generation 0"; | 31 "59052 typ host generation 0"; |
| 30 | 32 |
| 31 RTCIceCandidate *candidate = [[RTCIceCandidate alloc] initWithSdp:sdp | 33 RTCIceCandidate *candidate = [[RTCIceCandidate alloc] initWithSdp:sdp |
| 32 sdpMLineIndex:0 | 34 sdpMLineIndex:0 |
| 33 sdpMid:@"audio"]; | 35 sdpMid:@"audio"]; |
| 34 | 36 |
| 35 rtc::scoped_ptr<webrtc::IceCandidateInterface> nativeCandidate = | 37 std::unique_ptr<webrtc::IceCandidateInterface> nativeCandidate = |
| 36 candidate.nativeCandidate; | 38 candidate.nativeCandidate; |
| 37 EXPECT_EQ("audio", nativeCandidate->sdp_mid()); | 39 EXPECT_EQ("audio", nativeCandidate->sdp_mid()); |
| 38 EXPECT_EQ(0, nativeCandidate->sdp_mline_index()); | 40 EXPECT_EQ(0, nativeCandidate->sdp_mline_index()); |
| 39 | 41 |
| 40 std::string sdpString; | 42 std::string sdpString; |
| 41 nativeCandidate->ToString(&sdpString); | 43 nativeCandidate->ToString(&sdpString); |
| 42 EXPECT_EQ(sdp.stdString, sdpString); | 44 EXPECT_EQ(sdp.stdString, sdpString); |
| 43 } | 45 } |
| 44 | 46 |
| 45 - (void)testInitFromNativeCandidate { | 47 - (void)testInitFromNativeCandidate { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 65 [test testCandidate]; | 67 [test testCandidate]; |
| 66 } | 68 } |
| 67 } | 69 } |
| 68 | 70 |
| 69 TEST(RTCIceCandidateTest, InitFromCandidateTest) { | 71 TEST(RTCIceCandidateTest, InitFromCandidateTest) { |
| 70 @autoreleasepool { | 72 @autoreleasepool { |
| 71 RTCIceCandidateTest *test = [[RTCIceCandidateTest alloc] init]; | 73 RTCIceCandidateTest *test = [[RTCIceCandidateTest alloc] init]; |
| 72 [test testInitFromNativeCandidate]; | 74 [test testInitFromNativeCandidate]; |
| 73 } | 75 } |
| 74 } | 76 } |
| OLD | NEW |