| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "media/audio/alsa/alsa_output.h" | 6 #include "media/audio/alsa/alsa_output.h" |
| 7 #include "media/audio/alsa/alsa_wrapper.h" | 7 #include "media/audio/alsa/alsa_wrapper.h" |
| 8 #include "media/audio/alsa/audio_manager_alsa.h" | 8 #include "media/audio/alsa/audio_manager_alsa.h" |
| 9 #include "media/audio/fake_audio_log_factory.h" | 9 #include "media/audio/fake_audio_log_factory.h" |
| 10 #include "media/audio/mock_audio_source_callback.h" | 10 #include "media/audio/mock_audio_source_callback.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 kTestSampleRate, kTestBitsPerSample - 1, | 230 kTestSampleRate, kTestBitsPerSample - 1, |
| 231 kTestFramesPerPacket); | 231 kTestFramesPerPacket); |
| 232 test_stream = new AlsaPcmOutputStream(kTestDeviceName, | 232 test_stream = new AlsaPcmOutputStream(kTestDeviceName, |
| 233 bad_bps_params, | 233 bad_bps_params, |
| 234 &mock_alsa_wrapper_, | 234 &mock_alsa_wrapper_, |
| 235 mock_manager_.get()); | 235 mock_manager_.get()); |
| 236 EXPECT_EQ(AlsaPcmOutputStream::kInError, test_stream->state()); | 236 EXPECT_EQ(AlsaPcmOutputStream::kInError, test_stream->state()); |
| 237 test_stream->Close(); | 237 test_stream->Close(); |
| 238 | 238 |
| 239 // Bad format. | 239 // Bad format. |
| 240 AudioParameters bad_format_params( | 240 AudioParameters bad_format_params(static_cast<AudioParameters::Format>( |
| 241 AudioParameters::AUDIO_LAST_FORMAT, kTestChannelLayout, kTestSampleRate, | 241 AudioParameters::AUDIO_FORMAT_LAST + 1), |
| 242 kTestBitsPerSample, kTestFramesPerPacket); | 242 kTestChannelLayout, kTestSampleRate, |
| 243 kTestBitsPerSample, kTestFramesPerPacket); |
| 243 test_stream = new AlsaPcmOutputStream(kTestDeviceName, | 244 test_stream = new AlsaPcmOutputStream(kTestDeviceName, |
| 244 bad_format_params, | 245 bad_format_params, |
| 245 &mock_alsa_wrapper_, | 246 &mock_alsa_wrapper_, |
| 246 mock_manager_.get()); | 247 mock_manager_.get()); |
| 247 EXPECT_EQ(AlsaPcmOutputStream::kInError, test_stream->state()); | 248 EXPECT_EQ(AlsaPcmOutputStream::kInError, test_stream->state()); |
| 248 test_stream->Close(); | 249 test_stream->Close(); |
| 249 } | 250 } |
| 250 | 251 |
| 251 TEST_F(AlsaPcmOutputStreamTest, LatencyFloor) { | 252 TEST_F(AlsaPcmOutputStreamTest, LatencyFloor) { |
| 252 const double kMicrosPerFrame = | 253 const double kMicrosPerFrame = |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 | 860 |
| 860 // TODO(ajwong): Find a way to test whether or not another task has been | 861 // TODO(ajwong): Find a way to test whether or not another task has been |
| 861 // posted so we can verify that the Alsa code will indeed break the task | 862 // posted so we can verify that the Alsa code will indeed break the task |
| 862 // posting loop. | 863 // posting loop. |
| 863 | 864 |
| 864 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed); | 865 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed); |
| 865 test_stream->Close(); | 866 test_stream->Close(); |
| 866 } | 867 } |
| 867 | 868 |
| 868 } // namespace media | 869 } // namespace media |
| OLD | NEW |