OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "base/message_loop.h" |
6 #include "base/string_util.h" | 6 #include "base/stringprintf.h" |
7 #include "media/audio/linux/alsa_output.h" | 7 #include "media/audio/linux/alsa_output.h" |
8 #include "media/audio/linux/alsa_wrapper.h" | 8 #include "media/audio/linux/alsa_wrapper.h" |
9 #include "media/audio/linux/audio_manager_linux.h" | 9 #include "media/audio/linux/audio_manager_linux.h" |
10 #include "media/base/data_buffer.h" | 10 #include "media/base/data_buffer.h" |
11 #include "media/base/seekable_buffer.h" | 11 #include "media/base/seekable_buffer.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 using testing::_; | 15 using testing::_; |
16 using testing::AllOf; | 16 using testing::AllOf; |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 AlsaPcmOutputStream::kDefaultDevice, | 642 AlsaPcmOutputStream::kDefaultDevice, |
643 kSurround40, kSurround50, kSurround51, | 643 kSurround40, kSurround50, kSurround51, |
644 kSurround70, kSurround71, | 644 kSurround70, kSurround71, |
645 AlsaPcmOutputStream::kDefaultDevice }; | 645 AlsaPcmOutputStream::kDefaultDevice }; |
646 bool kExpectedDownmix[] = { false, false, false, false, false, true, | 646 bool kExpectedDownmix[] = { false, false, false, false, false, true, |
647 false, false, false, false }; | 647 false, false, false, false }; |
648 | 648 |
649 for (int i = 1; i <= 9; ++i) { | 649 for (int i = 1; i <= 9; ++i) { |
650 if (i == 3 || i == 4 || i == 5) // invalid number of channels | 650 if (i == 3 || i == 4 || i == 5) // invalid number of channels |
651 continue; | 651 continue; |
652 SCOPED_TRACE(StringPrintf("Attempting %d Channel", i)); | 652 SCOPED_TRACE(base::StringPrintf("Attempting %d Channel", i)); |
653 | 653 |
654 // Hints will only be grabbed for channel numbers that have non-default | 654 // Hints will only be grabbed for channel numbers that have non-default |
655 // devices associated with them. | 655 // devices associated with them. |
656 if (kExpectedDeviceName[i] != AlsaPcmOutputStream::kDefaultDevice) { | 656 if (kExpectedDeviceName[i] != AlsaPcmOutputStream::kDefaultDevice) { |
657 // The DeviceNameHint and DeviceNameFreeHint need to be paired to avoid a | 657 // The DeviceNameHint and DeviceNameFreeHint need to be paired to avoid a |
658 // memory leak. | 658 // memory leak. |
659 EXPECT_CALL(mock_alsa_wrapper_, DeviceNameHint(_, _, _)) | 659 EXPECT_CALL(mock_alsa_wrapper_, DeviceNameHint(_, _, _)) |
660 .WillOnce(DoAll(SetArgumentPointee<2>(&kFakeHints[0]), Return(0))); | 660 .WillOnce(DoAll(SetArgumentPointee<2>(&kFakeHints[0]), Return(0))); |
661 EXPECT_CALL(mock_alsa_wrapper_, DeviceNameFreeHint(&kFakeHints[0])) | 661 EXPECT_CALL(mock_alsa_wrapper_, DeviceNameFreeHint(&kFakeHints[0])) |
662 .Times(1); | 662 .Times(1); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 | 789 |
790 test_stream_->stop_stream_ = true; | 790 test_stream_->stop_stream_ = true; |
791 test_stream_->ScheduleNextWrite(true); | 791 test_stream_->ScheduleNextWrite(true); |
792 | 792 |
793 // TODO(ajwong): Find a way to test whether or not another task has been | 793 // TODO(ajwong): Find a way to test whether or not another task has been |
794 // posted so we can verify that the Alsa code will indeed break the task | 794 // posted so we can verify that the Alsa code will indeed break the task |
795 // posting loop. | 795 // posting loop. |
796 | 796 |
797 test_stream_->shared_data_.TransitionTo(AlsaPcmOutputStream::kIsClosed); | 797 test_stream_->shared_data_.TransitionTo(AlsaPcmOutputStream::kIsClosed); |
798 } | 798 } |
OLD | NEW |