| 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/message_loop/message_loop.h" | |
| 6 #include "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 7 #include "media/audio/alsa/alsa_output.h" | 6 #include "media/audio/alsa/alsa_output.h" |
| 8 #include "media/audio/alsa/alsa_wrapper.h" | 7 #include "media/audio/alsa/alsa_wrapper.h" |
| 9 #include "media/audio/alsa/audio_manager_alsa.h" | 8 #include "media/audio/alsa/audio_manager_alsa.h" |
| 10 #include "media/audio/fake_audio_log_factory.h" | 9 #include "media/audio/fake_audio_log_factory.h" |
| 11 #include "media/base/data_buffer.h" | 10 #include "media/base/data_buffer.h" |
| 12 #include "media/base/seekable_buffer.h" | 11 #include "media/base/seekable_buffer.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 14 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // We need to override this function in order to skip the checking the number | 94 // We need to override this function in order to skip the checking the number |
| 96 // of active output streams. It is because the number of active streams | 95 // of active output streams. It is because the number of active streams |
| 97 // is managed inside MakeAudioOutputStream, and we don't use | 96 // is managed inside MakeAudioOutputStream, and we don't use |
| 98 // MakeAudioOutputStream to create the stream in the tests. | 97 // MakeAudioOutputStream to create the stream in the tests. |
| 99 virtual void ReleaseOutputStream(AudioOutputStream* stream) OVERRIDE { | 98 virtual void ReleaseOutputStream(AudioOutputStream* stream) OVERRIDE { |
| 100 DCHECK(stream); | 99 DCHECK(stream); |
| 101 delete stream; | 100 delete stream; |
| 102 } | 101 } |
| 103 | 102 |
| 104 // We don't mock this method since all tests will do the same thing | 103 // We don't mock this method since all tests will do the same thing |
| 105 // and use the current message loop. | 104 // and use the current task runner. |
| 106 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE { | 105 virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() OVERRIDE { |
| 107 return base::MessageLoop::current()->message_loop_proxy(); | 106 return base::MessageLoop::current()->message_loop_proxy(); |
| 108 } | 107 } |
| 109 | 108 |
| 110 private: | 109 private: |
| 111 FakeAudioLogFactory fake_audio_log_factory_; | 110 FakeAudioLogFactory fake_audio_log_factory_; |
| 112 }; | 111 }; |
| 113 | 112 |
| 114 class AlsaPcmOutputStreamTest : public testing::Test { | 113 class AlsaPcmOutputStreamTest : public testing::Test { |
| 115 protected: | 114 protected: |
| 116 AlsaPcmOutputStreamTest() { | 115 AlsaPcmOutputStreamTest() { |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 | 865 |
| 867 // TODO(ajwong): Find a way to test whether or not another task has been | 866 // TODO(ajwong): Find a way to test whether or not another task has been |
| 868 // posted so we can verify that the Alsa code will indeed break the task | 867 // posted so we can verify that the Alsa code will indeed break the task |
| 869 // posting loop. | 868 // posting loop. |
| 870 | 869 |
| 871 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed); | 870 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed); |
| 872 test_stream->Close(); | 871 test_stream->Close(); |
| 873 } | 872 } |
| 874 | 873 |
| 875 } // namespace media | 874 } // namespace media |
| OLD | NEW |