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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/test/test_message_loop.h" | 10 #include "base/test/test_message_loop.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 class MockAudioManagerAlsa : public AudioManagerAlsa { | 76 class MockAudioManagerAlsa : public AudioManagerAlsa { |
77 public: | 77 public: |
78 MockAudioManagerAlsa() | 78 MockAudioManagerAlsa() |
79 : AudioManagerAlsa(base::ThreadTaskRunnerHandle::Get(), | 79 : AudioManagerAlsa(base::ThreadTaskRunnerHandle::Get(), |
80 base::ThreadTaskRunnerHandle::Get(), | 80 base::ThreadTaskRunnerHandle::Get(), |
81 &fake_audio_log_factory_) {} | 81 &fake_audio_log_factory_) {} |
82 MOCK_METHOD0(Init, void()); | 82 MOCK_METHOD0(Init, void()); |
83 MOCK_METHOD0(HasAudioOutputDevices, bool()); | 83 MOCK_METHOD0(HasAudioOutputDevices, bool()); |
84 MOCK_METHOD0(HasAudioInputDevices, bool()); | 84 MOCK_METHOD0(HasAudioInputDevices, bool()); |
85 MOCK_METHOD2(MakeLinearOutputStream, | 85 MOCK_METHOD1(MakeLinearOutputStream, AudioOutputStream*( |
86 AudioOutputStream*(const AudioParameters& params, | 86 const AudioParameters& params)); |
87 const LogCallback& log_callback)); | 87 MOCK_METHOD2(MakeLowLatencyOutputStream, AudioOutputStream*( |
88 MOCK_METHOD3(MakeLowLatencyOutputStream, | 88 const AudioParameters& params, |
89 AudioOutputStream*(const AudioParameters& params, | 89 const std::string& device_id)); |
90 const std::string& device_id, | 90 MOCK_METHOD2(MakeLowLatencyInputStream, AudioInputStream*( |
91 const LogCallback& log_callback)); | 91 const AudioParameters& params, const std::string& device_id)); |
92 MOCK_METHOD3(MakeLowLatencyInputStream, | |
93 AudioInputStream*(const AudioParameters& params, | |
94 const std::string& device_id, | |
95 const LogCallback& log_callback)); | |
96 | 92 |
97 // We need to override this function in order to skip the checking the number | 93 // We need to override this function in order to skip the checking the number |
98 // of active output streams. It is because the number of active streams | 94 // of active output streams. It is because the number of active streams |
99 // is managed inside MakeAudioOutputStream, and we don't use | 95 // is managed inside MakeAudioOutputStream, and we don't use |
100 // MakeAudioOutputStream to create the stream in the tests. | 96 // MakeAudioOutputStream to create the stream in the tests. |
101 void ReleaseOutputStream(AudioOutputStream* stream) override { | 97 void ReleaseOutputStream(AudioOutputStream* stream) override { |
102 DCHECK(stream); | 98 DCHECK(stream); |
103 delete stream; | 99 delete stream; |
104 } | 100 } |
105 | 101 |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 | 854 |
859 // TODO(ajwong): Find a way to test whether or not another task has been | 855 // TODO(ajwong): Find a way to test whether or not another task has been |
860 // posted so we can verify that the Alsa code will indeed break the task | 856 // posted so we can verify that the Alsa code will indeed break the task |
861 // posting loop. | 857 // posting loop. |
862 | 858 |
863 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed); | 859 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed); |
864 test_stream->Close(); | 860 test_stream->Close(); |
865 } | 861 } |
866 | 862 |
867 } // namespace media | 863 } // namespace media |
OLD | NEW |