| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 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 #include "webrtc/api/mediaconstraintsinterface.h" | 11 #include "webrtc/api/mediaconstraintsinterface.h" |
| 12 | 12 |
| 13 #include "webrtc/api/test/fakeconstraints.h" | 13 #include "webrtc/api/test/fakeconstraints.h" |
| 14 #include "webrtc/base/gunit.h" | 14 #include "webrtc/base/gunit.h" |
| 15 | 15 |
| 16 namespace webrtc { | 16 namespace webrtc { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // Checks all settings touched by CopyConstraintsIntoRtcConfiguration, |
| 21 // plus audio_jitter_buffer_max_packets. |
| 20 bool Matches(const PeerConnectionInterface::RTCConfiguration& a, | 22 bool Matches(const PeerConnectionInterface::RTCConfiguration& a, |
| 21 const PeerConnectionInterface::RTCConfiguration& b) { | 23 const PeerConnectionInterface::RTCConfiguration& b) { |
| 22 return a.audio_jitter_buffer_max_packets == | 24 return a.disable_ipv6 == b.disable_ipv6 && |
| 25 a.audio_jitter_buffer_max_packets == |
| 23 b.audio_jitter_buffer_max_packets && | 26 b.audio_jitter_buffer_max_packets && |
| 24 a.disable_prerenderer_smoothing == b.disable_prerenderer_smoothing; | 27 a.enable_rtp_data_channel == b.enable_rtp_data_channel && |
| 28 a.screencast_min_bitrate == b.screencast_min_bitrate && |
| 29 a.combined_audio_video_bwe == b.combined_audio_video_bwe && |
| 30 a.enable_dtls_srtp == b.enable_dtls_srtp && |
| 31 a.media_config.enable_dscp == b.media_config.enable_dscp && |
| 32 a.media_config.video.enable_cpu_overuse_detection == |
| 33 b.media_config.video.enable_cpu_overuse_detection && |
| 34 a.media_config.video.disable_prerenderer_smoothing == |
| 35 b.media_config.video.disable_prerenderer_smoothing && |
| 36 a.media_config.video.suspend_below_min_bitrate == |
| 37 b.media_config.video.suspend_below_min_bitrate; |
| 25 } | 38 } |
| 26 | 39 |
| 27 TEST(MediaConstraintsInterface, CopyConstraintsIntoRtcConfiguration) { | 40 TEST(MediaConstraintsInterface, CopyConstraintsIntoRtcConfiguration) { |
| 28 FakeConstraints constraints; | 41 FakeConstraints constraints; |
| 29 PeerConnectionInterface::RTCConfiguration old_configuration; | 42 PeerConnectionInterface::RTCConfiguration old_configuration; |
| 30 PeerConnectionInterface::RTCConfiguration configuration; | 43 PeerConnectionInterface::RTCConfiguration configuration; |
| 31 | 44 |
| 32 CopyConstraintsIntoRtcConfiguration(&constraints, &configuration); | 45 CopyConstraintsIntoRtcConfiguration(&constraints, &configuration); |
| 33 EXPECT_TRUE(Matches(old_configuration, configuration)); | 46 EXPECT_TRUE(Matches(old_configuration, configuration)); |
| 34 | 47 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 53 configuration.audio_jitter_buffer_max_packets = 34; | 66 configuration.audio_jitter_buffer_max_packets = 34; |
| 54 CopyConstraintsIntoRtcConfiguration(&constraints, &configuration); | 67 CopyConstraintsIntoRtcConfiguration(&constraints, &configuration); |
| 55 EXPECT_EQ(34, configuration.audio_jitter_buffer_max_packets); | 68 EXPECT_EQ(34, configuration.audio_jitter_buffer_max_packets); |
| 56 ASSERT_TRUE(configuration.enable_dtls_srtp); | 69 ASSERT_TRUE(configuration.enable_dtls_srtp); |
| 57 EXPECT_TRUE(*(configuration.enable_dtls_srtp)); | 70 EXPECT_TRUE(*(configuration.enable_dtls_srtp)); |
| 58 } | 71 } |
| 59 | 72 |
| 60 } // namespace | 73 } // namespace |
| 61 | 74 |
| 62 } // namespace webrtc | 75 } // namespace webrtc |
| OLD | NEW |