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

Side by Side Diff: webrtc/api/mediaconstraintsinterface_unittest.cc

Issue 2514883002: Create //webrtc/api:libjingle_peerconnection_api + refactorings. (Closed)
Patch Set: Rebase Created 3 years, 11 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
« no previous file with comments | « webrtc/api/localaudiosource_unittest.cc ('k') | webrtc/api/mediacontroller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 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 #include "webrtc/api/mediaconstraintsinterface.h"
12
13 #include "webrtc/api/test/fakeconstraints.h"
14 #include "webrtc/base/gunit.h"
15
16 namespace webrtc {
17
18 namespace {
19
20 // Checks all settings touched by CopyConstraintsIntoRtcConfiguration,
21 // plus audio_jitter_buffer_max_packets.
22 bool Matches(const PeerConnectionInterface::RTCConfiguration& a,
23 const PeerConnectionInterface::RTCConfiguration& b) {
24 return a.disable_ipv6 == b.disable_ipv6 &&
25 a.audio_jitter_buffer_max_packets ==
26 b.audio_jitter_buffer_max_packets &&
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;
38 }
39
40 TEST(MediaConstraintsInterface, CopyConstraintsIntoRtcConfiguration) {
41 FakeConstraints constraints;
42 PeerConnectionInterface::RTCConfiguration old_configuration;
43 PeerConnectionInterface::RTCConfiguration configuration;
44
45 CopyConstraintsIntoRtcConfiguration(&constraints, &configuration);
46 EXPECT_TRUE(Matches(old_configuration, configuration));
47
48 constraints.SetMandatory(MediaConstraintsInterface::kEnableIPv6, "true");
49 CopyConstraintsIntoRtcConfiguration(&constraints, &configuration);
50 EXPECT_FALSE(configuration.disable_ipv6);
51 constraints.SetMandatory(MediaConstraintsInterface::kEnableIPv6, "false");
52 CopyConstraintsIntoRtcConfiguration(&constraints, &configuration);
53 EXPECT_TRUE(configuration.disable_ipv6);
54
55 constraints.SetMandatory(MediaConstraintsInterface::kScreencastMinBitrate,
56 27);
57 CopyConstraintsIntoRtcConfiguration(&constraints, &configuration);
58 EXPECT_TRUE(configuration.screencast_min_bitrate);
59 EXPECT_EQ(27, *(configuration.screencast_min_bitrate));
60
61 // An empty set of constraints will not overwrite
62 // values that are already present.
63 constraints = FakeConstraints();
64 configuration = old_configuration;
65 configuration.enable_dtls_srtp = rtc::Optional<bool>(true);
66 configuration.audio_jitter_buffer_max_packets = 34;
67 CopyConstraintsIntoRtcConfiguration(&constraints, &configuration);
68 EXPECT_EQ(34, configuration.audio_jitter_buffer_max_packets);
69 ASSERT_TRUE(configuration.enable_dtls_srtp);
70 EXPECT_TRUE(*(configuration.enable_dtls_srtp));
71 }
72
73 } // namespace
74
75 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/localaudiosource_unittest.cc ('k') | webrtc/api/mediacontroller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698