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/bind.h" |
7 #include "base/macros.h" | 8 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
9 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
10 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
11 #include "base/test/simple_test_tick_clock.h" | 12 #include "base/test/simple_test_tick_clock.h" |
12 #include "base/test/test_message_loop.h" | 13 #include "base/test/test_message_loop.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "media/audio/alsa/alsa_output.h" | 16 #include "media/audio/alsa/alsa_output.h" |
16 #include "media/audio/alsa/alsa_wrapper.h" | 17 #include "media/audio/alsa/alsa_wrapper.h" |
17 #include "media/audio/alsa/audio_manager_alsa.h" | 18 #include "media/audio/alsa/audio_manager_alsa.h" |
| 19 #include "media/audio/fake_audio_file_writer.h" |
18 #include "media/audio/fake_audio_log_factory.h" | 20 #include "media/audio/fake_audio_log_factory.h" |
19 #include "media/audio/mock_audio_source_callback.h" | 21 #include "media/audio/mock_audio_source_callback.h" |
20 #include "media/base/audio_timestamp_helper.h" | 22 #include "media/base/audio_timestamp_helper.h" |
21 #include "media/base/data_buffer.h" | 23 #include "media/base/data_buffer.h" |
22 #include "media/base/seekable_buffer.h" | 24 #include "media/base/seekable_buffer.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 25 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
25 | 27 |
26 using testing::_; | 28 using testing::_; |
27 using testing::AllOf; | 29 using testing::AllOf; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 MOCK_METHOD1(PcmStart, int(snd_pcm_t* handle)); | 77 MOCK_METHOD1(PcmStart, int(snd_pcm_t* handle)); |
76 | 78 |
77 MOCK_METHOD1(StrError, const char*(int errnum)); | 79 MOCK_METHOD1(StrError, const char*(int errnum)); |
78 }; | 80 }; |
79 | 81 |
80 class MockAudioManagerAlsa : public AudioManagerAlsa { | 82 class MockAudioManagerAlsa : public AudioManagerAlsa { |
81 public: | 83 public: |
82 MockAudioManagerAlsa() | 84 MockAudioManagerAlsa() |
83 : AudioManagerAlsa(base::ThreadTaskRunnerHandle::Get(), | 85 : AudioManagerAlsa(base::ThreadTaskRunnerHandle::Get(), |
84 base::ThreadTaskRunnerHandle::Get(), | 86 base::ThreadTaskRunnerHandle::Get(), |
85 &fake_audio_log_factory_) {} | 87 &fake_audio_log_factory_, |
| 88 base::Bind(&FakeAudioFileWriter::Create)) {} |
86 MOCK_METHOD0(Init, void()); | 89 MOCK_METHOD0(Init, void()); |
87 MOCK_METHOD0(HasAudioOutputDevices, bool()); | 90 MOCK_METHOD0(HasAudioOutputDevices, bool()); |
88 MOCK_METHOD0(HasAudioInputDevices, bool()); | 91 MOCK_METHOD0(HasAudioInputDevices, bool()); |
89 MOCK_METHOD2(MakeLinearOutputStream, | 92 MOCK_METHOD2(MakeLinearOutputStream, |
90 AudioOutputStream*(const AudioParameters& params, | 93 AudioOutputStream*(const AudioParameters& params, |
91 const LogCallback& log_callback)); | 94 const LogCallback& log_callback)); |
92 MOCK_METHOD3(MakeLowLatencyOutputStream, | 95 MOCK_METHOD3(MakeLowLatencyOutputStream, |
93 AudioOutputStream*(const AudioParameters& params, | 96 AudioOutputStream*(const AudioParameters& params, |
94 const std::string& device_id, | 97 const std::string& device_id, |
95 const LogCallback& log_callback)); | 98 const LogCallback& log_callback)); |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 | 881 |
879 // TODO(ajwong): Find a way to test whether or not another task has been | 882 // TODO(ajwong): Find a way to test whether or not another task has been |
880 // posted so we can verify that the Alsa code will indeed break the task | 883 // posted so we can verify that the Alsa code will indeed break the task |
881 // posting loop. | 884 // posting loop. |
882 | 885 |
883 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed); | 886 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed); |
884 test_stream->Close(); | 887 test_stream->Close(); |
885 } | 888 } |
886 | 889 |
887 } // namespace media | 890 } // namespace media |
OLD | NEW |