Chromium Code Reviews| 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 <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "webrtc/base/gunit.h" | 15 #include "webrtc/base/gunit.h" |
| 16 | 16 |
| 17 #import "NSString+StdString.h" | 17 #import "NSString+StdString.h" |
| 18 #import "RTCConfiguration+Private.h" | 18 #import "RTCConfiguration+Private.h" |
| 19 #import "WebRTC/RTCConfiguration.h" | 19 #import "WebRTC/RTCConfiguration.h" |
| 20 #import "WebRTC/RTCPeerConnection.h" | 20 #import "WebRTC/RTCPeerConnection.h" |
| 21 #import "WebRTC/RTCPeerConnectionFactory.h" | 21 #import "WebRTC/RTCPeerConnectionFactory.h" |
| 22 #import "WebRTC/RTCIceServer.h" | 22 #import "WebRTC/RTCIceServer.h" |
| 23 #import "WebRTC/RTCMediaConstraints.h" | 23 #import "WebRTC/RTCMediaConstraints.h" |
| 24 #import "WebRTC/RTCTracing.h" | |
| 24 | 25 |
| 25 @interface RTCPeerConnectionTest : NSObject | 26 @interface RTCPeerConnectionTest : NSObject |
| 26 - (void)testConfigurationGetter; | 27 - (void)testConfigurationGetter; |
| 28 - (void)tracingTestNoInitialization; | |
|
tkchin_webrtc
2017/06/27 22:56:40
This shouldn't belong in RTCPeerConnectionTest.
Wr
| |
| 27 @end | 29 @end |
| 28 | 30 |
| 29 @implementation RTCPeerConnectionTest | 31 @implementation RTCPeerConnectionTest |
| 30 | 32 |
| 31 - (void)testConfigurationGetter { | 33 - (void)testConfigurationGetter { |
| 32 NSArray *urlStrings = @[ @"stun:stun1.example.net" ]; | 34 NSArray *urlStrings = @[ @"stun:stun1.example.net" ]; |
| 33 RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:urlStrings]; | 35 RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:urlStrings]; |
| 34 | 36 |
| 35 RTCConfiguration *config = [[RTCConfiguration alloc] init]; | 37 RTCConfiguration *config = [[RTCConfiguration alloc] init]; |
| 36 config.iceServers = @[ server ]; | 38 config.iceServers = @[ server ]; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 EXPECT_EQ(config.candidateNetworkPolicy, newConfig.candidateNetworkPolicy); | 76 EXPECT_EQ(config.candidateNetworkPolicy, newConfig.candidateNetworkPolicy); |
| 75 EXPECT_EQ(config.audioJitterBufferMaxPackets, newConfig.audioJitterBufferMaxPa ckets); | 77 EXPECT_EQ(config.audioJitterBufferMaxPackets, newConfig.audioJitterBufferMaxPa ckets); |
| 76 EXPECT_EQ(config.audioJitterBufferFastAccelerate, newConfig.audioJitterBufferF astAccelerate); | 78 EXPECT_EQ(config.audioJitterBufferFastAccelerate, newConfig.audioJitterBufferF astAccelerate); |
| 77 EXPECT_EQ(config.iceConnectionReceivingTimeout, newConfig.iceConnectionReceivi ngTimeout); | 79 EXPECT_EQ(config.iceConnectionReceivingTimeout, newConfig.iceConnectionReceivi ngTimeout); |
| 78 EXPECT_EQ(config.iceBackupCandidatePairPingInterval, | 80 EXPECT_EQ(config.iceBackupCandidatePairPingInterval, |
| 79 newConfig.iceBackupCandidatePairPingInterval); | 81 newConfig.iceBackupCandidatePairPingInterval); |
| 80 EXPECT_EQ(config.continualGatheringPolicy, newConfig.continualGatheringPolicy) ; | 82 EXPECT_EQ(config.continualGatheringPolicy, newConfig.continualGatheringPolicy) ; |
| 81 EXPECT_EQ(config.shouldPruneTurnPorts, newConfig.shouldPruneTurnPorts); | 83 EXPECT_EQ(config.shouldPruneTurnPorts, newConfig.shouldPruneTurnPorts); |
| 82 } | 84 } |
| 83 | 85 |
| 86 - (NSString *)documentsFilePathForFileName:(NSString *)fileName { | |
| 87 NSParameterAssert(fileName.length); | |
| 88 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUs erDomainMask, YES); | |
| 89 NSString *documentsDirPath = paths.firstObject; | |
| 90 NSString *filePath = | |
| 91 [documentsDirPath stringByAppendingPathComponent:fileName]; | |
| 92 return filePath; | |
| 93 } | |
| 94 | |
| 95 - (void)tracingTestNoInitialization { | |
| 96 NSString *filePath = [self documentsFilePathForFileName:@"webrtc-trace.txt"]; | |
| 97 EXPECT_EQ(NO, RTCStartInternalCapture(filePath)); | |
| 98 RTCStopInternalCapture(); | |
| 99 } | |
| 100 | |
| 84 @end | 101 @end |
| 85 | 102 |
| 86 TEST(RTCPeerConnectionTest, ConfigurationGetterTest) { | 103 TEST(RTCPeerConnectionTest, ConfigurationGetterTest) { |
| 87 @autoreleasepool { | 104 @autoreleasepool { |
| 88 RTCPeerConnectionTest *test = [[RTCPeerConnectionTest alloc] init]; | 105 RTCPeerConnectionTest *test = [[RTCPeerConnectionTest alloc] init]; |
| 89 [test testConfigurationGetter]; | 106 [test testConfigurationGetter]; |
| 90 } | 107 } |
| 91 } | 108 } |
| 92 | 109 |
| 110 TEST(RTCPeerConnectionTest, TracingTestNoInitialization) { | |
| 111 @autoreleasepool { | |
| 112 RTCPeerConnectionTest *test = [[RTCPeerConnectionTest alloc] init]; | |
| 113 [test tracingTestNoInitialization]; | |
| 114 } | |
| 115 } | |
| 93 | 116 |
| OLD | NEW |