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/logging.h" | 5 #include "base/logging.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "media/audio/linux/alsa_output.h" | 8 #include "media/audio/linux/alsa_output.h" |
9 #include "media/audio/linux/alsa_wrapper.h" | 9 #include "media/audio/linux/alsa_wrapper.h" |
10 #include "media/audio/linux/audio_manager_linux.h" | 10 #include "media/audio/linux/audio_manager_linux.h" |
(...skipping 53 matching lines...) Loading... |
64 MOCK_METHOD4(OnMoreData, uint32(AudioOutputStream* stream, void* dest, | 64 MOCK_METHOD4(OnMoreData, uint32(AudioOutputStream* stream, void* dest, |
65 uint32 max_size, uint32 pending_bytes)); | 65 uint32 max_size, uint32 pending_bytes)); |
66 MOCK_METHOD1(OnClose, void(AudioOutputStream* stream)); | 66 MOCK_METHOD1(OnClose, void(AudioOutputStream* stream)); |
67 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); | 67 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); |
68 }; | 68 }; |
69 | 69 |
70 class MockAudioManagerLinux : public AudioManagerLinux { | 70 class MockAudioManagerLinux : public AudioManagerLinux { |
71 public: | 71 public: |
72 MOCK_METHOD0(Init, void()); | 72 MOCK_METHOD0(Init, void()); |
73 MOCK_METHOD0(HasAudioOutputDevices, bool()); | 73 MOCK_METHOD0(HasAudioOutputDevices, bool()); |
| 74 MOCK_METHOD0(HasAudioInputDevices, bool()); |
74 MOCK_METHOD4(MakeAudioOutputStream, AudioOutputStream*(Format format, | 75 MOCK_METHOD4(MakeAudioOutputStream, AudioOutputStream*(Format format, |
75 int channels, | 76 int channels, |
76 int sample_rate, | 77 int sample_rate, |
77 char bits_per_sample)); | 78 char bits_per_sample)); |
| 79 MOCK_METHOD5(MakeAudioInputStream, AudioInputStream*( |
| 80 Format format, |
| 81 int channels, |
| 82 int sample_rate, |
| 83 char bits_per_sample, |
| 84 uint32 samples_per_packet)); |
78 MOCK_METHOD0(MuteAll, void()); | 85 MOCK_METHOD0(MuteAll, void()); |
79 MOCK_METHOD0(UnMuteAll, void()); | 86 MOCK_METHOD0(UnMuteAll, void()); |
80 | 87 |
81 MOCK_METHOD1(ReleaseOutputStream, void(AlsaPcmOutputStream* stream)); | 88 MOCK_METHOD1(ReleaseOutputStream, void(AlsaPcmOutputStream* stream)); |
82 }; | 89 }; |
83 | 90 |
84 class AlsaPcmOutputStreamTest : public testing::Test { | 91 class AlsaPcmOutputStreamTest : public testing::Test { |
85 protected: | 92 protected: |
86 AlsaPcmOutputStreamTest() { | 93 AlsaPcmOutputStreamTest() { |
87 test_stream_ = CreateStreamWithChannels(kTestChannels); | 94 test_stream_ = CreateStreamWithChannels(kTestChannels); |
(...skipping 687 matching lines...) Loading... |
775 | 782 |
776 test_stream_->stop_stream_ = true; | 783 test_stream_->stop_stream_ = true; |
777 test_stream_->ScheduleNextWrite(true); | 784 test_stream_->ScheduleNextWrite(true); |
778 | 785 |
779 // TODO(ajwong): Find a way to test whether or not another task has been | 786 // TODO(ajwong): Find a way to test whether or not another task has been |
780 // posted so we can verify that the Alsa code will indeed break the task | 787 // posted so we can verify that the Alsa code will indeed break the task |
781 // posting loop. | 788 // posting loop. |
782 | 789 |
783 test_stream_->shared_data_.TransitionTo(AlsaPcmOutputStream::kIsClosed); | 790 test_stream_->shared_data_.TransitionTo(AlsaPcmOutputStream::kIsClosed); |
784 } | 791 } |
OLD | NEW |