| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Basic test of the AudioParameters class using default construction where | 105 // Basic test of the AudioParameters class using default construction where |
| 106 // all members are set to zero. | 106 // all members are set to zero. |
| 107 TEST_F(AudioManagerTest, AudioParametersWithDefaultConstruction) { | 107 TEST_F(AudioManagerTest, AudioParametersWithDefaultConstruction) { |
| 108 AudioParameters params; | 108 AudioParameters params; |
| 109 EXPECT_FALSE(params.is_valid()); | 109 EXPECT_FALSE(params.is_valid()); |
| 110 EXPECT_EQ(0, params.sample_rate()); | 110 EXPECT_EQ(0, params.sample_rate()); |
| 111 EXPECT_EQ(0, params.channels()); | 111 EXPECT_EQ(0, params.channels()); |
| 112 EXPECT_EQ(0, params.frames_per_buffer()); | 112 EXPECT_EQ(0, params.frames_per_buffer()); |
| 113 EXPECT_EQ(0, params.frames_per_10ms_buffer()); | 113 EXPECT_EQ(0U, params.frames_per_10ms_buffer()); |
| 114 EXPECT_EQ(0, params.GetBytesPerFrame()); | 114 EXPECT_EQ(0, params.GetBytesPerFrame()); |
| 115 EXPECT_EQ(0, params.GetBytesPerBuffer()); | 115 EXPECT_EQ(0, params.GetBytesPerBuffer()); |
| 116 EXPECT_EQ(0, params.GetBytesPer10msBuffer()); | 116 EXPECT_EQ(0U, params.GetBytesPer10msBuffer()); |
| 117 EXPECT_EQ(0.0f, params.GetBufferSizeInMilliseconds()); | 117 EXPECT_EQ(0.0f, params.GetBufferSizeInMilliseconds()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Basic test of the AudioParameters class using non default construction. | 120 // Basic test of the AudioParameters class using non default construction. |
| 121 TEST_F(AudioManagerTest, AudioParametersWithNonDefaultConstruction) { | 121 TEST_F(AudioManagerTest, AudioParametersWithNonDefaultConstruction) { |
| 122 const int kSampleRate = 48000; | 122 const int kSampleRate = 48000; |
| 123 const int kChannels = 1; | 123 const int kChannels = 1; |
| 124 const int kFramesPerBuffer = 480; | 124 const int kFramesPerBuffer = 480; |
| 125 const int kFramesPer10msBuffer = 480; | 125 const size_t kFramesPer10msBuffer = 480; |
| 126 const int kBytesPerFrame = 2; | 126 const int kBytesPerFrame = 2; |
| 127 const float kBufferSizeInMs = 10.0f; | 127 const float kBufferSizeInMs = 10.0f; |
| 128 AudioParameters params(kSampleRate, kChannels, kFramesPerBuffer); | 128 AudioParameters params(kSampleRate, kChannels, kFramesPerBuffer); |
| 129 EXPECT_TRUE(params.is_valid()); | 129 EXPECT_TRUE(params.is_valid()); |
| 130 EXPECT_EQ(kSampleRate, params.sample_rate()); | 130 EXPECT_EQ(kSampleRate, params.sample_rate()); |
| 131 EXPECT_EQ(kChannels, params.channels()); | 131 EXPECT_EQ(kChannels, params.channels()); |
| 132 EXPECT_EQ(kFramesPerBuffer, params.frames_per_buffer()); | 132 EXPECT_EQ(kFramesPerBuffer, params.frames_per_buffer()); |
| 133 EXPECT_EQ(kSampleRate / 100, params.frames_per_10ms_buffer()); | 133 EXPECT_EQ(static_cast<size_t>(kSampleRate / 100), |
| 134 params.frames_per_10ms_buffer()); |
| 134 EXPECT_EQ(kBytesPerFrame, params.GetBytesPerFrame()); | 135 EXPECT_EQ(kBytesPerFrame, params.GetBytesPerFrame()); |
| 135 EXPECT_EQ(kBytesPerFrame * kFramesPerBuffer, params.GetBytesPerBuffer()); | 136 EXPECT_EQ(kBytesPerFrame * kFramesPerBuffer, params.GetBytesPerBuffer()); |
| 136 EXPECT_EQ(kBytesPerFrame * kFramesPer10msBuffer, | 137 EXPECT_EQ(kBytesPerFrame * kFramesPer10msBuffer, |
| 137 params.GetBytesPer10msBuffer()); | 138 params.GetBytesPer10msBuffer()); |
| 138 EXPECT_EQ(kBufferSizeInMs, params.GetBufferSizeInMilliseconds()); | 139 EXPECT_EQ(kBufferSizeInMs, params.GetBufferSizeInMilliseconds()); |
| 139 } | 140 } |
| 140 | 141 |
| 141 } // namespace webrtc | 142 } // namespace webrtc |
| 142 | 143 |
| OLD | NEW |