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

Side by Side Diff: webrtc/api/objctests/RTCIceServerTest.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 <vector>
14
15 #include "webrtc/base/gunit.h"
16
17 #import "webrtc/api/objc/RTCIceServer.h"
18 #import "webrtc/api/objc/RTCIceServer+Private.h"
19 #import "webrtc/base/objc/NSString+StdString.h"
20
21 @interface RTCIceServerTest : NSObject
22 - (void)testOneURLServer;
23 - (void)testTwoURLServer;
24 - (void)testPasswordCredential;
25 - (void)testInitFromNativeServer;
26 @end
27
28 @implementation RTCIceServerTest
29
30 - (void)testOneURLServer {
31 RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:@[
32 @"stun:stun1.example.net" ]];
33
34 webrtc::PeerConnectionInterface::IceServer iceStruct = server.nativeServer;
35 EXPECT_EQ(1u, iceStruct.urls.size());
36 EXPECT_EQ("stun:stun1.example.net", iceStruct.urls.front());
37 EXPECT_EQ("", iceStruct.username);
38 EXPECT_EQ("", iceStruct.password);
39 }
40
41 - (void)testTwoURLServer {
42 RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:@[
43 @"turn1:turn1.example.net", @"turn2:turn2.example.net" ]];
44
45 webrtc::PeerConnectionInterface::IceServer iceStruct = server.nativeServer;
46 EXPECT_EQ(2u, iceStruct.urls.size());
47 EXPECT_EQ("turn1:turn1.example.net", iceStruct.urls.front());
48 EXPECT_EQ("turn2:turn2.example.net", iceStruct.urls.back());
49 EXPECT_EQ("", iceStruct.username);
50 EXPECT_EQ("", iceStruct.password);
51 }
52
53 - (void)testPasswordCredential {
54 RTCIceServer *server = [[RTCIceServer alloc]
55 initWithURLStrings:@[ @"turn1:turn1.example.net" ]
56 username:@"username"
57 credential:@"credential"];
58 webrtc::PeerConnectionInterface::IceServer iceStruct = server.nativeServer;
59 EXPECT_EQ(1u, iceStruct.urls.size());
60 EXPECT_EQ("turn1:turn1.example.net", iceStruct.urls.front());
61 EXPECT_EQ("username", iceStruct.username);
62 EXPECT_EQ("credential", iceStruct.password);
63 }
64
65 - (void)testInitFromNativeServer {
66 webrtc::PeerConnectionInterface::IceServer nativeServer;
67 nativeServer.username = "username";
68 nativeServer.password = "password";
69 nativeServer.urls.push_back("stun:stun.example.net");
70
71 RTCIceServer *iceServer =
72 [[RTCIceServer alloc] initWithNativeServer:nativeServer];
73 EXPECT_EQ(1u, iceServer.urlStrings.count);
74 EXPECT_EQ("stun:stun.example.net",
75 [NSString stdStringForString:iceServer.urlStrings.firstObject]);
76 EXPECT_EQ("username", [NSString stdStringForString:iceServer.username]);
77 EXPECT_EQ("password", [NSString stdStringForString:iceServer.credential]);
78 }
79
80 @end
81
82 TEST(RTCIceServerTest, OneURLTest) {
83 @autoreleasepool {
84 RTCIceServerTest *test = [[RTCIceServerTest alloc] init];
85 [test testOneURLServer];
86 }
87 }
88
89 TEST(RTCIceServerTest, TwoURLTest) {
90 @autoreleasepool {
91 RTCIceServerTest *test = [[RTCIceServerTest alloc] init];
92 [test testTwoURLServer];
93 }
94 }
95
96 TEST(RTCIceServerTest, PasswordCredentialTest) {
97 @autoreleasepool {
98 RTCIceServerTest *test = [[RTCIceServerTest alloc] init];
99 [test testPasswordCredential];
100 }
101 }
102
103 TEST(RTCIceServerTest, InitFromNativeServerTest) {
104 @autoreleasepool {
105 RTCIceServerTest *test = [[RTCIceServerTest alloc] init];
106 [test testInitFromNativeServer];
107 }
108 }
OLDNEW
« no previous file with comments | « webrtc/api/objctests/RTCIceCandidateTest.mm ('k') | webrtc/api/objctests/RTCMediaConstraintsTest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698