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

Side by Side Diff: webrtc/modules/audio_mixer/test/audio_mixer_unittest.cc

Issue 2302483002: Style changes in Audio Mixer (Closed)
Patch Set: Removed size_t everywhere in favor of int. Created 4 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 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 <string.h> 11 #include <string.h>
12 12
13 #include <memory> 13 #include <memory>
14 #include <utility> 14 #include <utility>
15 15
16 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
17 #include "webrtc/modules/audio_mixer/audio_mixer.h"
17 #include "webrtc/modules/audio_mixer/audio_mixer_defines.h" 18 #include "webrtc/modules/audio_mixer/audio_mixer_defines.h"
18 #include "webrtc/modules/audio_mixer/audio_mixer.h"
19 19
20 using testing::_; 20 using testing::_;
21 using testing::Exactly; 21 using testing::Exactly;
22 using testing::Invoke; 22 using testing::Invoke;
23 using testing::Return; 23 using testing::Return;
24 24
25 namespace webrtc { 25 namespace webrtc {
26 26
27 namespace { 27 namespace {
28 28
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 278 }
279 } 279 }
280 280
281 TEST(AudioMixer, ParticipantNumberOfChannels) { 281 TEST(AudioMixer, ParticipantNumberOfChannels) {
282 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId)); 282 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId));
283 283
284 MockMixerAudioSource participant; 284 MockMixerAudioSource participant;
285 ResetFrame(participant.fake_frame()); 285 ResetFrame(participant.fake_frame());
286 286
287 EXPECT_EQ(0, mixer->SetMixabilityStatus(&participant, true)); 287 EXPECT_EQ(0, mixer->SetMixabilityStatus(&participant, true));
288 for (size_t number_of_channels : {1, 2}) { 288 for (int number_of_channels : {1, 2}) {
289 EXPECT_CALL(participant, GetAudioFrameWithMuted(_, kDefaultSampleRateHz)) 289 EXPECT_CALL(participant, GetAudioFrameWithMuted(_, kDefaultSampleRateHz))
290 .Times(Exactly(1)); 290 .Times(Exactly(1));
291 mixer->Mix(kDefaultSampleRateHz, number_of_channels, &frame_for_mixing); 291 mixer->Mix(kDefaultSampleRateHz, number_of_channels, &frame_for_mixing);
292 EXPECT_EQ(number_of_channels, frame_for_mixing.num_channels_); 292 EXPECT_EQ(static_cast<size_t>(number_of_channels),
293 frame_for_mixing.num_channels_);
293 } 294 }
294 } 295 }
295 296
296 // Test that the volume is reported as zero when the mixer input 297 // Test that the volume is reported as zero when the mixer input
297 // comprises only zero values. 298 // comprises only zero values.
298 TEST(AudioMixer, LevelIsZeroWhenMixingZeroes) { 299 TEST(AudioMixer, LevelIsZeroWhenMixingZeroes) {
299 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId)); 300 const std::unique_ptr<AudioMixer> mixer(AudioMixer::Create(kId));
300 301
301 MockMixerAudioSource participant; 302 MockMixerAudioSource participant;
302 ResetFrame(participant.fake_frame()); 303 ResetFrame(participant.fake_frame());
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 kAudioSources, MixerAudioSource::AudioFrameInfo::kNormal); 468 kAudioSources, MixerAudioSource::AudioFrameInfo::kNormal);
468 frame_info[0] = MixerAudioSource::AudioFrameInfo::kMuted; 469 frame_info[0] = MixerAudioSource::AudioFrameInfo::kMuted;
469 std::fill(frames[0].data_, frames[0].data_ + kDefaultSampleRateHz / 100, 470 std::fill(frames[0].data_, frames[0].data_ + kDefaultSampleRateHz / 100,
470 std::numeric_limits<int16_t>::max()); 471 std::numeric_limits<int16_t>::max());
471 std::vector<bool> expected_status(kAudioSources, true); 472 std::vector<bool> expected_status(kAudioSources, true);
472 expected_status[0] = false; 473 expected_status[0] = false;
473 474
474 MixAndCompare(frames, frame_info, expected_status); 475 MixAndCompare(frames, frame_info, expected_status);
475 } 476 }
476 } // namespace webrtc 477 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698