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

Side by Side Diff: talk/app/webrtc/localaudiosource_unittest.cc

Issue 1430433004: Replace rtc::cricket::Settable with rtc::Maybe (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 1 month 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 | « talk/app/webrtc/localaudiosource.cc ('k') | talk/app/webrtc/videosource.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 constraints.AddOptional( 51 constraints.AddOptional(
52 MediaConstraintsInterface::kExperimentalAutoGainControl, true); 52 MediaConstraintsInterface::kExperimentalAutoGainControl, true);
53 constraints.AddMandatory(MediaConstraintsInterface::kNoiseSuppression, false); 53 constraints.AddMandatory(MediaConstraintsInterface::kNoiseSuppression, false);
54 constraints.AddOptional(MediaConstraintsInterface::kHighpassFilter, true); 54 constraints.AddOptional(MediaConstraintsInterface::kHighpassFilter, true);
55 constraints.AddOptional(MediaConstraintsInterface::kAecDump, true); 55 constraints.AddOptional(MediaConstraintsInterface::kAecDump, true);
56 56
57 rtc::scoped_refptr<LocalAudioSource> source = 57 rtc::scoped_refptr<LocalAudioSource> source =
58 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), 58 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
59 &constraints); 59 &constraints);
60 60
61 bool value; 61 EXPECT_EQ(rtc::Maybe<bool>(false), source->options().echo_cancellation);
62 EXPECT_TRUE(source->options().echo_cancellation.Get(&value)); 62 EXPECT_EQ(rtc::Maybe<bool>(true), source->options().extended_filter_aec);
63 EXPECT_FALSE(value); 63 EXPECT_EQ(rtc::Maybe<bool>(true), source->options().delay_agnostic_aec);
64 EXPECT_TRUE(source->options().extended_filter_aec.Get(&value)); 64 EXPECT_EQ(rtc::Maybe<bool>(true), source->options().auto_gain_control);
65 EXPECT_TRUE(value); 65 EXPECT_EQ(rtc::Maybe<bool>(true), source->options().experimental_agc);
66 EXPECT_TRUE(source->options().delay_agnostic_aec.Get(&value)); 66 EXPECT_EQ(rtc::Maybe<bool>(false), source->options().noise_suppression);
67 EXPECT_TRUE(value); 67 EXPECT_EQ(rtc::Maybe<bool>(true), source->options().highpass_filter);
68 EXPECT_TRUE(source->options().auto_gain_control.Get(&value)); 68 EXPECT_EQ(rtc::Maybe<bool>(true), source->options().aec_dump);
69 EXPECT_TRUE(value);
70 EXPECT_TRUE(source->options().experimental_agc.Get(&value));
71 EXPECT_TRUE(value);
72 EXPECT_TRUE(source->options().noise_suppression.Get(&value));
73 EXPECT_FALSE(value);
74 EXPECT_TRUE(source->options().highpass_filter.Get(&value));
75 EXPECT_TRUE(value);
76 EXPECT_TRUE(source->options().aec_dump.Get(&value));
77 EXPECT_TRUE(value);
78 } 69 }
79 70
80 TEST(LocalAudioSourceTest, OptionNotSet) { 71 TEST(LocalAudioSourceTest, OptionNotSet) {
81 webrtc::FakeConstraints constraints; 72 webrtc::FakeConstraints constraints;
82 rtc::scoped_refptr<LocalAudioSource> source = 73 rtc::scoped_refptr<LocalAudioSource> source =
83 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), 74 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
84 &constraints); 75 &constraints);
85 bool value; 76 EXPECT_EQ(rtc::Maybe<bool>(), source->options().highpass_filter);
86 EXPECT_FALSE(source->options().highpass_filter.Get(&value));
87 } 77 }
88 78
89 TEST(LocalAudioSourceTest, MandatoryOverridesOptional) { 79 TEST(LocalAudioSourceTest, MandatoryOverridesOptional) {
90 webrtc::FakeConstraints constraints; 80 webrtc::FakeConstraints constraints;
91 constraints.AddMandatory( 81 constraints.AddMandatory(
92 MediaConstraintsInterface::kGoogEchoCancellation, false); 82 MediaConstraintsInterface::kGoogEchoCancellation, false);
93 constraints.AddOptional( 83 constraints.AddOptional(
94 MediaConstraintsInterface::kGoogEchoCancellation, true); 84 MediaConstraintsInterface::kGoogEchoCancellation, true);
95 85
96 rtc::scoped_refptr<LocalAudioSource> source = 86 rtc::scoped_refptr<LocalAudioSource> source =
97 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), 87 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
98 &constraints); 88 &constraints);
99 89
100 bool value; 90 EXPECT_EQ(rtc::Maybe<bool>(false), source->options().echo_cancellation);
101 EXPECT_TRUE(source->options().echo_cancellation.Get(&value));
102 EXPECT_FALSE(value);
103 } 91 }
104 92
105 TEST(LocalAudioSourceTest, InvalidOptional) { 93 TEST(LocalAudioSourceTest, InvalidOptional) {
106 webrtc::FakeConstraints constraints; 94 webrtc::FakeConstraints constraints;
107 constraints.AddOptional(MediaConstraintsInterface::kHighpassFilter, false); 95 constraints.AddOptional(MediaConstraintsInterface::kHighpassFilter, false);
108 constraints.AddOptional("invalidKey", false); 96 constraints.AddOptional("invalidKey", false);
109 97
110 rtc::scoped_refptr<LocalAudioSource> source = 98 rtc::scoped_refptr<LocalAudioSource> source =
111 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), 99 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
112 &constraints); 100 &constraints);
113 101
114 EXPECT_EQ(MediaSourceInterface::kLive, source->state()); 102 EXPECT_EQ(MediaSourceInterface::kLive, source->state());
115 bool value; 103 EXPECT_EQ(rtc::Maybe<bool>(false), source->options().highpass_filter);
116 EXPECT_TRUE(source->options().highpass_filter.Get(&value));
117 EXPECT_FALSE(value);
118 } 104 }
119 105
120 TEST(LocalAudioSourceTest, InvalidMandatory) { 106 TEST(LocalAudioSourceTest, InvalidMandatory) {
121 webrtc::FakeConstraints constraints; 107 webrtc::FakeConstraints constraints;
122 constraints.AddMandatory(MediaConstraintsInterface::kHighpassFilter, false); 108 constraints.AddMandatory(MediaConstraintsInterface::kHighpassFilter, false);
123 constraints.AddMandatory("invalidKey", false); 109 constraints.AddMandatory("invalidKey", false);
124 110
125 rtc::scoped_refptr<LocalAudioSource> source = 111 rtc::scoped_refptr<LocalAudioSource> source =
126 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), 112 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
127 &constraints); 113 &constraints);
128 114
129 EXPECT_EQ(MediaSourceInterface::kLive, source->state()); 115 EXPECT_EQ(MediaSourceInterface::kLive, source->state());
130 bool value; 116 EXPECT_EQ(rtc::Maybe<bool>(false), source->options().highpass_filter);
131 EXPECT_TRUE(source->options().highpass_filter.Get(&value));
132 EXPECT_FALSE(value);
133 } 117 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/localaudiosource.cc ('k') | talk/app/webrtc/videosource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698