| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "media/audio/cras/audio_manager_cras.h" | 10 #include "media/audio/cras/audio_manager_cras.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 kTestSampleRate, | 145 kTestSampleRate, |
| 146 kTestBitsPerSample - 1, | 146 kTestBitsPerSample - 1, |
| 147 kTestFramesPerPacket); | 147 kTestFramesPerPacket); |
| 148 CrasInputStream* test_stream = new CrasInputStream( | 148 CrasInputStream* test_stream = new CrasInputStream( |
| 149 bad_bps_params, mock_manager_.get(), AudioManagerBase::kDefaultDeviceId); | 149 bad_bps_params, mock_manager_.get(), AudioManagerBase::kDefaultDeviceId); |
| 150 EXPECT_FALSE(test_stream->Open()); | 150 EXPECT_FALSE(test_stream->Open()); |
| 151 test_stream->Close(); | 151 test_stream->Close(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 TEST_F(CrasInputStreamTest, BadFormat) { | 154 TEST_F(CrasInputStreamTest, BadFormat) { |
| 155 AudioParameters bad_format_params(AudioParameters::AUDIO_LAST_FORMAT, | 155 AudioParameters bad_format_params(static_cast<AudioParameters::Format>( |
| 156 kTestChannelLayout, | 156 AudioParameters::AUDIO_FORMAT_LAST + 1), |
| 157 kTestSampleRate, | 157 kTestChannelLayout, kTestSampleRate, |
| 158 kTestBitsPerSample, | 158 kTestBitsPerSample, kTestFramesPerPacket); |
| 159 kTestFramesPerPacket); | |
| 160 CrasInputStream* test_stream = new CrasInputStream( | 159 CrasInputStream* test_stream = new CrasInputStream( |
| 161 bad_format_params, mock_manager_.get(), | 160 bad_format_params, mock_manager_.get(), |
| 162 AudioManagerBase::kDefaultDeviceId); | 161 AudioManagerBase::kDefaultDeviceId); |
| 163 EXPECT_FALSE(test_stream->Open()); | 162 EXPECT_FALSE(test_stream->Open()); |
| 164 test_stream->Close(); | 163 test_stream->Close(); |
| 165 } | 164 } |
| 166 | 165 |
| 167 TEST_F(CrasInputStreamTest, BadSampleRate) { | 166 TEST_F(CrasInputStreamTest, BadSampleRate) { |
| 168 AudioParameters bad_rate_params(kTestFormat, | 167 AudioParameters bad_rate_params(kTestFormat, |
| 169 kTestChannelLayout, | 168 kTestChannelLayout, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 TEST_F(CrasInputStreamTest, CaptureLoopback) { | 220 TEST_F(CrasInputStreamTest, CaptureLoopback) { |
| 222 CrasInputStream* test_stream = CreateStream( | 221 CrasInputStream* test_stream = CreateStream( |
| 223 CHANNEL_LAYOUT_STEREO, | 222 CHANNEL_LAYOUT_STEREO, |
| 224 kTestFramesPerPacket, | 223 kTestFramesPerPacket, |
| 225 AudioManagerBase::kLoopbackInputDeviceId); | 224 AudioManagerBase::kLoopbackInputDeviceId); |
| 226 EXPECT_TRUE(test_stream->Open()); | 225 EXPECT_TRUE(test_stream->Open()); |
| 227 test_stream->Close(); | 226 test_stream->Close(); |
| 228 } | 227 } |
| 229 | 228 |
| 230 } // namespace media | 229 } // namespace media |
| OLD | NEW |