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 |
(...skipping 17 matching lines...) Expand all Loading... |
28 - (void)testConversionToNativeConfiguration { | 28 - (void)testConversionToNativeConfiguration { |
29 NSArray *urlStrings = @[ @"stun:stun1.example.net" ]; | 29 NSArray *urlStrings = @[ @"stun:stun1.example.net" ]; |
30 RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:urlStrings]; | 30 RTCIceServer *server = [[RTCIceServer alloc] initWithURLStrings:urlStrings]; |
31 | 31 |
32 RTCConfiguration *config = [[RTCConfiguration alloc] init]; | 32 RTCConfiguration *config = [[RTCConfiguration alloc] init]; |
33 config.iceServers = @[ server ]; | 33 config.iceServers = @[ server ]; |
34 config.iceTransportPolicy = RTCIceTransportPolicyRelay; | 34 config.iceTransportPolicy = RTCIceTransportPolicyRelay; |
35 config.bundlePolicy = RTCBundlePolicyMaxBundle; | 35 config.bundlePolicy = RTCBundlePolicyMaxBundle; |
36 config.rtcpMuxPolicy = RTCRtcpMuxPolicyNegotiate; | 36 config.rtcpMuxPolicy = RTCRtcpMuxPolicyNegotiate; |
37 config.tcpCandidatePolicy = RTCTcpCandidatePolicyDisabled; | 37 config.tcpCandidatePolicy = RTCTcpCandidatePolicyDisabled; |
| 38 config.candidateNetworkPolicy = RTCCandidateNetworkPolicyLowCost; |
38 const int maxPackets = 60; | 39 const int maxPackets = 60; |
39 const int timeout = 1; | 40 const int timeout = 1; |
40 const int interval = 2; | 41 const int interval = 2; |
41 config.audioJitterBufferMaxPackets = maxPackets; | 42 config.audioJitterBufferMaxPackets = maxPackets; |
42 config.iceConnectionReceivingTimeout = timeout; | 43 config.iceConnectionReceivingTimeout = timeout; |
43 config.iceBackupCandidatePairPingInterval = interval; | 44 config.iceBackupCandidatePairPingInterval = interval; |
44 config.continualGatheringPolicy = | 45 config.continualGatheringPolicy = |
45 RTCContinualGatheringPolicyGatherContinually; | 46 RTCContinualGatheringPolicyGatherContinually; |
46 | 47 |
47 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> | 48 std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> |
48 nativeConfig([config createNativeConfiguration]); | 49 nativeConfig([config createNativeConfiguration]); |
49 EXPECT_TRUE(nativeConfig.get()); | 50 EXPECT_TRUE(nativeConfig.get()); |
50 EXPECT_EQ(1u, nativeConfig->servers.size()); | 51 EXPECT_EQ(1u, nativeConfig->servers.size()); |
51 webrtc::PeerConnectionInterface::IceServer nativeServer = | 52 webrtc::PeerConnectionInterface::IceServer nativeServer = |
52 nativeConfig->servers.front(); | 53 nativeConfig->servers.front(); |
53 EXPECT_EQ(1u, nativeServer.urls.size()); | 54 EXPECT_EQ(1u, nativeServer.urls.size()); |
54 EXPECT_EQ("stun:stun1.example.net", nativeServer.urls.front()); | 55 EXPECT_EQ("stun:stun1.example.net", nativeServer.urls.front()); |
55 | 56 |
56 EXPECT_EQ(webrtc::PeerConnectionInterface::kRelay, nativeConfig->type); | 57 EXPECT_EQ(webrtc::PeerConnectionInterface::kRelay, nativeConfig->type); |
57 EXPECT_EQ(webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle, | 58 EXPECT_EQ(webrtc::PeerConnectionInterface::kBundlePolicyMaxBundle, |
58 nativeConfig->bundle_policy); | 59 nativeConfig->bundle_policy); |
59 EXPECT_EQ(webrtc::PeerConnectionInterface::kRtcpMuxPolicyNegotiate, | 60 EXPECT_EQ(webrtc::PeerConnectionInterface::kRtcpMuxPolicyNegotiate, |
60 nativeConfig->rtcp_mux_policy); | 61 nativeConfig->rtcp_mux_policy); |
61 EXPECT_EQ(webrtc::PeerConnectionInterface::kTcpCandidatePolicyDisabled, | 62 EXPECT_EQ(webrtc::PeerConnectionInterface::kTcpCandidatePolicyDisabled, |
62 nativeConfig->tcp_candidate_policy); | 63 nativeConfig->tcp_candidate_policy); |
| 64 EXPECT_EQ(webrtc::PeerConnectionInterface::kCandidateNetworkPolicyLowCost, |
| 65 nativeConfig->candidate_network_policy); |
63 EXPECT_EQ(maxPackets, nativeConfig->audio_jitter_buffer_max_packets); | 66 EXPECT_EQ(maxPackets, nativeConfig->audio_jitter_buffer_max_packets); |
64 EXPECT_EQ(timeout, nativeConfig->ice_connection_receiving_timeout); | 67 EXPECT_EQ(timeout, nativeConfig->ice_connection_receiving_timeout); |
65 EXPECT_EQ(interval, nativeConfig->ice_backup_candidate_pair_ping_interval); | 68 EXPECT_EQ(interval, nativeConfig->ice_backup_candidate_pair_ping_interval); |
66 EXPECT_EQ(webrtc::PeerConnectionInterface::GATHER_CONTINUALLY, | 69 EXPECT_EQ(webrtc::PeerConnectionInterface::GATHER_CONTINUALLY, |
67 nativeConfig->continual_gathering_policy); | 70 nativeConfig->continual_gathering_policy); |
68 } | 71 } |
69 | 72 |
70 @end | 73 @end |
71 | 74 |
72 TEST(RTCConfigurationTest, NativeConfigurationConversionTest) { | 75 TEST(RTCConfigurationTest, NativeConfigurationConversionTest) { |
73 @autoreleasepool { | 76 @autoreleasepool { |
74 RTCConfigurationTest *test = [[RTCConfigurationTest alloc] init]; | 77 RTCConfigurationTest *test = [[RTCConfigurationTest alloc] init]; |
75 [test testConversionToNativeConfiguration]; | 78 [test testConversionToNativeConfiguration]; |
76 } | 79 } |
77 } | 80 } |
78 | 81 |
OLD | NEW |