OLD | NEW |
1 // Copyright (c) 2010 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/string_util.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" |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 | 430 |
431 // Expect Device setup. | 431 // Expect Device setup. |
432 EXPECT_CALL(mock_alsa_wrapper_, PcmDrop(kFakeHandle)) | 432 EXPECT_CALL(mock_alsa_wrapper_, PcmDrop(kFakeHandle)) |
433 .WillOnce(Return(0)); | 433 .WillOnce(Return(0)); |
434 EXPECT_CALL(mock_alsa_wrapper_, PcmPrepare(kFakeHandle)) | 434 EXPECT_CALL(mock_alsa_wrapper_, PcmPrepare(kFakeHandle)) |
435 .WillOnce(Return(0)); | 435 .WillOnce(Return(0)); |
436 | 436 |
437 // Expect the pre-roll. | 437 // Expect the pre-roll. |
438 MockAudioSourceCallback mock_callback; | 438 MockAudioSourceCallback mock_callback; |
439 EXPECT_CALL(mock_alsa_wrapper_, PcmState(kFakeHandle)) | 439 EXPECT_CALL(mock_alsa_wrapper_, PcmState(kFakeHandle)) |
440 .Times(2) | 440 .Times(3) |
441 .WillRepeatedly(Return(SND_PCM_STATE_RUNNING)); | 441 .WillRepeatedly(Return(SND_PCM_STATE_RUNNING)); |
442 EXPECT_CALL(mock_alsa_wrapper_, PcmDelay(kFakeHandle, _)) | 442 EXPECT_CALL(mock_alsa_wrapper_, PcmDelay(kFakeHandle, _)) |
443 .Times(2) | 443 .Times(2) |
444 .WillRepeatedly(DoAll(SetArgumentPointee<1>(0), Return(0))); | 444 .WillRepeatedly(DoAll(SetArgumentPointee<1>(0), Return(0))); |
445 EXPECT_CALL(mock_callback, | 445 EXPECT_CALL(mock_callback, |
446 OnMoreData(test_stream_.get(), _, kTestPacketSize, _)) | 446 OnMoreData(test_stream_.get(), _, kTestPacketSize, _)) |
447 .Times(2) | 447 .Times(2) |
448 .WillOnce(Return(kTestPacketSize)) | 448 .WillOnce(Return(kTestPacketSize)) |
449 .WillOnce(Return(0)); | 449 .WillOnce(Return(0)); |
450 EXPECT_CALL(mock_alsa_wrapper_, PcmWritei(kFakeHandle, _, _)) | 450 EXPECT_CALL(mock_alsa_wrapper_, PcmWritei(kFakeHandle, _, _)) |
(...skipping 338 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 |