| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 MOCK_METHOD2(MakeLowLatencyOutputStream, AudioOutputStream*( | 78 MOCK_METHOD2(MakeLowLatencyOutputStream, AudioOutputStream*( |
| 79 const AudioParameters& params, | 79 const AudioParameters& params, |
| 80 const std::string& device_id)); | 80 const std::string& device_id)); |
| 81 MOCK_METHOD2(MakeLowLatencyInputStream, AudioInputStream*( | 81 MOCK_METHOD2(MakeLowLatencyInputStream, AudioInputStream*( |
| 82 const AudioParameters& params, const std::string& device_id)); | 82 const AudioParameters& params, const std::string& device_id)); |
| 83 | 83 |
| 84 // We need to override this function in order to skip the checking the number | 84 // We need to override this function in order to skip the checking the number |
| 85 // of active output streams. It is because the number of active streams | 85 // of active output streams. It is because the number of active streams |
| 86 // is managed inside MakeAudioOutputStream, and we don't use | 86 // is managed inside MakeAudioOutputStream, and we don't use |
| 87 // MakeAudioOutputStream to create the stream in the tests. | 87 // MakeAudioOutputStream to create the stream in the tests. |
| 88 virtual void ReleaseOutputStream(AudioOutputStream* stream) OVERRIDE { | 88 virtual void ReleaseOutputStream(AudioOutputStream* stream) override { |
| 89 DCHECK(stream); | 89 DCHECK(stream); |
| 90 delete stream; | 90 delete stream; |
| 91 } | 91 } |
| 92 | 92 |
| 93 // We don't mock this method since all tests will do the same thing | 93 // We don't mock this method since all tests will do the same thing |
| 94 // and use the current task runner. | 94 // and use the current task runner. |
| 95 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() OVERRIDE { | 95 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override { |
| 96 return base::MessageLoop::current()->message_loop_proxy(); | 96 return base::MessageLoop::current()->message_loop_proxy(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 FakeAudioLogFactory fake_audio_log_factory_; | 100 FakeAudioLogFactory fake_audio_log_factory_; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 class AlsaPcmOutputStreamTest : public testing::Test { | 103 class AlsaPcmOutputStreamTest : public testing::Test { |
| 104 protected: | 104 protected: |
| 105 AlsaPcmOutputStreamTest() { | 105 AlsaPcmOutputStreamTest() { |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 | 852 |
| 853 // TODO(ajwong): Find a way to test whether or not another task has been | 853 // TODO(ajwong): Find a way to test whether or not another task has been |
| 854 // posted so we can verify that the Alsa code will indeed break the task | 854 // posted so we can verify that the Alsa code will indeed break the task |
| 855 // posting loop. | 855 // posting loop. |
| 856 | 856 |
| 857 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed); | 857 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed); |
| 858 test_stream->Close(); | 858 test_stream->Close(); |
| 859 } | 859 } |
| 860 | 860 |
| 861 } // namespace media | 861 } // namespace media |
| OLD | NEW |