OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "media/audio/linux/alsa_output.h" | 7 #include "media/audio/linux/alsa_output.h" |
8 #include "media/audio/linux/alsa_wrapper.h" | 8 #include "media/audio/linux/alsa_wrapper.h" |
9 #include "media/audio/linux/audio_manager_linux.h" | 9 #include "media/audio/linux/audio_manager_linux.h" |
10 #include "media/base/data_buffer.h" | 10 #include "media/base/data_buffer.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 MOCK_METHOD4(PcmOpen, int(snd_pcm_t** handle, const char* name, | 37 MOCK_METHOD4(PcmOpen, int(snd_pcm_t** handle, const char* name, |
38 snd_pcm_stream_t stream, int mode)); | 38 snd_pcm_stream_t stream, int mode)); |
39 MOCK_METHOD1(PcmClose, int(snd_pcm_t* handle)); | 39 MOCK_METHOD1(PcmClose, int(snd_pcm_t* handle)); |
40 MOCK_METHOD1(PcmPrepare, int(snd_pcm_t* handle)); | 40 MOCK_METHOD1(PcmPrepare, int(snd_pcm_t* handle)); |
41 MOCK_METHOD1(PcmDrop, int(snd_pcm_t* handle)); | 41 MOCK_METHOD1(PcmDrop, int(snd_pcm_t* handle)); |
42 MOCK_METHOD2(PcmDelay, int(snd_pcm_t* handle, snd_pcm_sframes_t* delay)); | 42 MOCK_METHOD2(PcmDelay, int(snd_pcm_t* handle, snd_pcm_sframes_t* delay)); |
43 MOCK_METHOD3(PcmWritei, snd_pcm_sframes_t(snd_pcm_t* handle, | 43 MOCK_METHOD3(PcmWritei, snd_pcm_sframes_t(snd_pcm_t* handle, |
44 const void* buffer, | 44 const void* buffer, |
45 snd_pcm_uframes_t size)); | 45 snd_pcm_uframes_t size)); |
| 46 MOCK_METHOD3(PcmReadi, snd_pcm_sframes_t(snd_pcm_t* handle, |
| 47 void* buffer, |
| 48 snd_pcm_uframes_t size)); |
46 MOCK_METHOD3(PcmRecover, int(snd_pcm_t* handle, int err, int silent)); | 49 MOCK_METHOD3(PcmRecover, int(snd_pcm_t* handle, int err, int silent)); |
47 MOCK_METHOD7(PcmSetParams, int(snd_pcm_t* handle, snd_pcm_format_t format, | 50 MOCK_METHOD7(PcmSetParams, int(snd_pcm_t* handle, snd_pcm_format_t format, |
48 snd_pcm_access_t access, unsigned int channels, | 51 snd_pcm_access_t access, unsigned int channels, |
49 unsigned int rate, int soft_resample, | 52 unsigned int rate, int soft_resample, |
50 unsigned int latency)); | 53 unsigned int latency)); |
51 MOCK_METHOD3(PcmGetParams, int(snd_pcm_t* handle, | 54 MOCK_METHOD3(PcmGetParams, int(snd_pcm_t* handle, |
52 snd_pcm_uframes_t* buffer_size, | 55 snd_pcm_uframes_t* buffer_size, |
53 snd_pcm_uframes_t* period_size)); | 56 snd_pcm_uframes_t* period_size)); |
54 MOCK_METHOD1(PcmName, const char*(snd_pcm_t* handle)); | 57 MOCK_METHOD1(PcmName, const char*(snd_pcm_t* handle)); |
55 MOCK_METHOD1(PcmAvailUpdate, snd_pcm_sframes_t(snd_pcm_t* handle)); | 58 MOCK_METHOD1(PcmAvailUpdate, snd_pcm_sframes_t(snd_pcm_t* handle)); |
56 MOCK_METHOD1(PcmState, snd_pcm_state_t(snd_pcm_t* handle)); | 59 MOCK_METHOD1(PcmState, snd_pcm_state_t(snd_pcm_t* handle)); |
| 60 MOCK_METHOD1(PcmStart, int(snd_pcm_t* handle)); |
57 | 61 |
58 MOCK_METHOD1(StrError, const char*(int errnum)); | 62 MOCK_METHOD1(StrError, const char*(int errnum)); |
59 }; | 63 }; |
60 | 64 |
61 class MockAudioSourceCallback : public AudioOutputStream::AudioSourceCallback { | 65 class MockAudioSourceCallback : public AudioOutputStream::AudioSourceCallback { |
62 public: | 66 public: |
63 MOCK_METHOD4(OnMoreData, uint32(AudioOutputStream* stream, void* dest, | 67 MOCK_METHOD4(OnMoreData, uint32(AudioOutputStream* stream, void* dest, |
64 uint32 max_size, uint32 pending_bytes)); | 68 uint32 max_size, uint32 pending_bytes)); |
65 MOCK_METHOD1(OnClose, void(AudioOutputStream* stream)); | 69 MOCK_METHOD1(OnClose, void(AudioOutputStream* stream)); |
66 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); | 70 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 | 765 |
762 test_stream_->stop_stream_ = true; | 766 test_stream_->stop_stream_ = true; |
763 test_stream_->ScheduleNextWrite(true); | 767 test_stream_->ScheduleNextWrite(true); |
764 | 768 |
765 // TODO(ajwong): Find a way to test whether or not another task has been | 769 // TODO(ajwong): Find a way to test whether or not another task has been |
766 // posted so we can verify that the Alsa code will indeed break the task | 770 // posted so we can verify that the Alsa code will indeed break the task |
767 // posting loop. | 771 // posting loop. |
768 | 772 |
769 test_stream_->shared_data_.TransitionTo(AlsaPcmOutputStream::kIsClosed); | 773 test_stream_->shared_data_.TransitionTo(AlsaPcmOutputStream::kIsClosed); |
770 } | 774 } |
OLD | NEW |