Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (c) 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 "testing/gtest/include/gtest/gtest.h" | |
| 12 #include "webrtc/modules/audio_processing/audio_buffer.h" | |
| 13 | |
| 14 namespace webrtc { | |
| 15 | |
| 16 namespace { | |
| 17 | |
| 18 void ExpectNumChannels(const AudioBuffer& ab, size_t num_channels) { | |
| 19 EXPECT_EQ(ab.data()->num_channels(), num_channels); | |
| 20 EXPECT_EQ(ab.data_f()->num_channels(), num_channels); | |
| 21 EXPECT_EQ(ab.split_data()->num_channels(), num_channels); | |
| 22 EXPECT_EQ(ab.split_data_f()->num_channels(), num_channels); | |
| 23 EXPECT_EQ(ab.num_channels(), num_channels); | |
| 24 } | |
| 25 | |
| 26 } // namespace | |
|
tlegrand-webrtc
2016/06/28 13:48:05
Fault tests?
aluebs-webrtc
2016/06/29 00:48:40
I don't think there is a way to catch DCHECKs, rig
hlundin-webrtc
2016/06/29 08:21:16
Yes, there is. You can use death tests. See https:
aluebs-webrtc
2016/06/29 23:02:58
Thank you for pointing that out. Now I added death
| |
| 27 | |
| 28 TEST(AudioBufferTest, SetNumChannelsSetsChannelBuffersNumChannels) { | |
| 29 const size_t kNumFrames = 480u; | |
| 30 const size_t kStereo = 2u; | |
| 31 const size_t kMono = 1u; | |
| 32 AudioBuffer ab(kNumFrames, kStereo, kNumFrames, kStereo, kNumFrames); | |
| 33 ExpectNumChannels(ab, kStereo); | |
| 34 ab.set_num_channels(kMono); | |
| 35 ExpectNumChannels(ab, kMono); | |
| 36 ab.InitForNewData(); | |
| 37 ExpectNumChannels(ab, kStereo); | |
| 38 } | |
| 39 | |
| 40 } // namespace webrtc | |
| OLD | NEW |