Chromium Code Reviews| 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 #include <vector> | |
|
tkchin_webrtc
2015/12/04 20:17:09
system includes before library includes
#include
hjon
2015/12/07 20:03:53
Done.
| |
| 15 | |
| 16 #import "webrtc/base/objc/RTCLogging.h" | |
| 17 #import "webrtc/api/objc/RTCIceServer.h" | |
| 18 #import "webrtc/api/objc/RTCIceServer+Private.h" | |
| 19 | |
| 20 @interface RTCIceServerTest : NSObject | |
| 21 - (void)testOneURLServer; | |
| 22 - (void)testTwoURLServer; | |
| 23 - (void)testPasswordCredential; | |
| 24 @end | |
| 25 | |
| 26 @implementation RTCIceServerTest | |
| 27 | |
| 28 - (void)testOneURLServer { | |
| 29 RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:@[@"stun:stun1 .example.net"]]; | |
|
tkchin_webrtc
2015/12/04 20:17:10
nit: space after [ and before ]
@[ @"foo" ];
her
hjon
2015/12/07 20:03:53
Done.
| |
| 30 | |
| 31 webrtc::PeerConnectionInterface::IceServer iceStruct = server.iceServer; | |
| 32 EXPECT_EQ((unsigned long)1, iceStruct.urls.size()); | |
|
tkchin_webrtc
2015/12/04 20:17:09
size_t? or just 1l
here and elsewhere
hjon
2015/12/07 20:03:53
Done.
| |
| 33 EXPECT_EQ("stun:stun1.example.net", iceStruct.urls.front()); | |
| 34 EXPECT_EQ("", iceStruct.username); | |
| 35 EXPECT_EQ("", iceStruct.password); | |
| 36 } | |
| 37 | |
| 38 - (void)testTwoURLServer { | |
| 39 RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:@[@"turn1:turn 1.example.net", | |
| 40 @"turn2:turn 2.example.net"]]; | |
| 41 | |
| 42 webrtc::PeerConnectionInterface::IceServer iceStruct = server.iceServer; | |
| 43 EXPECT_EQ((unsigned long)2, iceStruct.urls.size()); | |
| 44 EXPECT_EQ("turn1:turn1.example.net", iceStruct.urls.front()); | |
| 45 EXPECT_EQ("turn2:turn2.example.net", iceStruct.urls.back()); | |
| 46 EXPECT_EQ("", iceStruct.username); | |
| 47 EXPECT_EQ("", iceStruct.password); | |
| 48 } | |
| 49 | |
| 50 - (void)testPasswordCredential { | |
| 51 RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:@[@"turn1:turn 1.example.net"] | |
| 52 username:@"username" | |
| 53 credential:@"credential"] ; | |
| 54 webrtc::PeerConnectionInterface::IceServer iceStruct = server.iceServer; | |
| 55 EXPECT_EQ((unsigned long)1, iceStruct.urls.size()); | |
| 56 EXPECT_EQ("turn1:turn1.example.net", iceStruct.urls.front()); | |
| 57 EXPECT_EQ("username", iceStruct.username); | |
| 58 EXPECT_EQ("credential", iceStruct.password); | |
| 59 } | |
| 60 | |
| 61 @end | |
| 62 | |
| 63 TEST(RTCIceServerTest, OneURLTest) { | |
| 64 @autoreleasepool { | |
| 65 RTCIceServerTest *test = [[RTCIceServerTest alloc] init]; | |
| 66 [test testOneURLServer]; | |
| 67 } | |
| 68 } | |
| 69 | |
| 70 TEST(RTCIceServerTest, TwoURLTest) { | |
| 71 @autoreleasepool { | |
| 72 RTCIceServerTest *test = [[RTCIceServerTest alloc] init]; | |
| 73 [test testTwoURLServer]; | |
| 74 } | |
| 75 } | |
| 76 | |
| 77 TEST(RTCIceServerTest, PasswordCredentialTest) { | |
| 78 @autoreleasepool { | |
| 79 RTCIceServerTest *test = [[RTCIceServerTest alloc] init]; | |
| 80 [test testPasswordCredential]; | |
| 81 } | |
| 82 } | |
| OLD | NEW |