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

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

Issue 1432553007: Rename Maybe to Optional (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 EXPECT_EQ(rtc::Maybe<bool>(false), source->options().echo_cancellation); 61 EXPECT_EQ(rtc::Optional<bool>(false), source->options().echo_cancellation);
62 EXPECT_EQ(rtc::Maybe<bool>(true), source->options().extended_filter_aec); 62 EXPECT_EQ(rtc::Optional<bool>(true), source->options().extended_filter_aec);
63 EXPECT_EQ(rtc::Maybe<bool>(true), source->options().delay_agnostic_aec); 63 EXPECT_EQ(rtc::Optional<bool>(true), source->options().delay_agnostic_aec);
64 EXPECT_EQ(rtc::Maybe<bool>(true), source->options().auto_gain_control); 64 EXPECT_EQ(rtc::Optional<bool>(true), source->options().auto_gain_control);
65 EXPECT_EQ(rtc::Maybe<bool>(true), source->options().experimental_agc); 65 EXPECT_EQ(rtc::Optional<bool>(true), source->options().experimental_agc);
66 EXPECT_EQ(rtc::Maybe<bool>(false), source->options().noise_suppression); 66 EXPECT_EQ(rtc::Optional<bool>(false), source->options().noise_suppression);
67 EXPECT_EQ(rtc::Maybe<bool>(true), source->options().highpass_filter); 67 EXPECT_EQ(rtc::Optional<bool>(true), source->options().highpass_filter);
68 EXPECT_EQ(rtc::Maybe<bool>(true), source->options().aec_dump); 68 EXPECT_EQ(rtc::Optional<bool>(true), source->options().aec_dump);
69 } 69 }
70 70
71 TEST(LocalAudioSourceTest, OptionNotSet) { 71 TEST(LocalAudioSourceTest, OptionNotSet) {
72 webrtc::FakeConstraints constraints; 72 webrtc::FakeConstraints constraints;
73 rtc::scoped_refptr<LocalAudioSource> source = 73 rtc::scoped_refptr<LocalAudioSource> source =
74 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), 74 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
75 &constraints); 75 &constraints);
76 EXPECT_EQ(rtc::Maybe<bool>(), source->options().highpass_filter); 76 EXPECT_EQ(rtc::Optional<bool>(), source->options().highpass_filter);
77 } 77 }
78 78
79 TEST(LocalAudioSourceTest, MandatoryOverridesOptional) { 79 TEST(LocalAudioSourceTest, MandatoryOverridesOptional) {
80 webrtc::FakeConstraints constraints; 80 webrtc::FakeConstraints constraints;
81 constraints.AddMandatory( 81 constraints.AddMandatory(
82 MediaConstraintsInterface::kGoogEchoCancellation, false); 82 MediaConstraintsInterface::kGoogEchoCancellation, false);
83 constraints.AddOptional( 83 constraints.AddOptional(
84 MediaConstraintsInterface::kGoogEchoCancellation, true); 84 MediaConstraintsInterface::kGoogEchoCancellation, true);
85 85
86 rtc::scoped_refptr<LocalAudioSource> source = 86 rtc::scoped_refptr<LocalAudioSource> source =
87 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), 87 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
88 &constraints); 88 &constraints);
89 89
90 EXPECT_EQ(rtc::Maybe<bool>(false), source->options().echo_cancellation); 90 EXPECT_EQ(rtc::Optional<bool>(false), source->options().echo_cancellation);
91 } 91 }
92 92
93 TEST(LocalAudioSourceTest, InvalidOptional) { 93 TEST(LocalAudioSourceTest, InvalidOptional) {
94 webrtc::FakeConstraints constraints; 94 webrtc::FakeConstraints constraints;
95 constraints.AddOptional(MediaConstraintsInterface::kHighpassFilter, false); 95 constraints.AddOptional(MediaConstraintsInterface::kHighpassFilter, false);
96 constraints.AddOptional("invalidKey", false); 96 constraints.AddOptional("invalidKey", false);
97 97
98 rtc::scoped_refptr<LocalAudioSource> source = 98 rtc::scoped_refptr<LocalAudioSource> source =
99 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), 99 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
100 &constraints); 100 &constraints);
101 101
102 EXPECT_EQ(MediaSourceInterface::kLive, source->state()); 102 EXPECT_EQ(MediaSourceInterface::kLive, source->state());
103 EXPECT_EQ(rtc::Maybe<bool>(false), source->options().highpass_filter); 103 EXPECT_EQ(rtc::Optional<bool>(false), source->options().highpass_filter);
104 } 104 }
105 105
106 TEST(LocalAudioSourceTest, InvalidMandatory) { 106 TEST(LocalAudioSourceTest, InvalidMandatory) {
107 webrtc::FakeConstraints constraints; 107 webrtc::FakeConstraints constraints;
108 constraints.AddMandatory(MediaConstraintsInterface::kHighpassFilter, false); 108 constraints.AddMandatory(MediaConstraintsInterface::kHighpassFilter, false);
109 constraints.AddMandatory("invalidKey", false); 109 constraints.AddMandatory("invalidKey", false);
110 110
111 rtc::scoped_refptr<LocalAudioSource> source = 111 rtc::scoped_refptr<LocalAudioSource> source =
112 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), 112 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(),
113 &constraints); 113 &constraints);
114 114
115 EXPECT_EQ(MediaSourceInterface::kLive, source->state()); 115 EXPECT_EQ(MediaSourceInterface::kLive, source->state());
116 EXPECT_EQ(rtc::Maybe<bool>(false), source->options().highpass_filter); 116 EXPECT_EQ(rtc::Optional<bool>(false), source->options().highpass_filter);
117 } 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