OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/logging.h" | 5 #include "base/logging.h" |
6 #include "media/audio/linux/alsa_output.h" | 6 #include "media/audio/linux/alsa_output.h" |
7 #include "media/audio/linux/alsa_wrapper.h" | 7 #include "media/audio/linux/alsa_wrapper.h" |
8 #include "media/audio/linux/audio_manager_linux.h" | 8 #include "media/audio/linux/audio_manager_linux.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 EXPECT_TRUE(test_stream_->packet_.get()); | 208 EXPECT_TRUE(test_stream_->packet_.get()); |
209 EXPECT_FALSE(test_stream_->stop_stream_); | 209 EXPECT_FALSE(test_stream_->stop_stream_); |
210 | 210 |
211 // Now close it and test that everything was released. | 211 // Now close it and test that everything was released. |
212 EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)) | 212 EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)) |
213 .WillOnce(Return(0)); | 213 .WillOnce(Return(0)); |
214 EXPECT_CALL(mock_manager_, ReleaseStream(test_stream_.get())); | 214 EXPECT_CALL(mock_manager_, ReleaseStream(test_stream_.get())); |
215 test_stream_->Close(); | 215 test_stream_->Close(); |
216 message_loop_.RunAllPending(); | 216 message_loop_.RunAllPending(); |
217 | 217 |
218 EXPECT_TRUE(NULL == test_stream_->playback_handle_); | 218 EXPECT_EQ(NULL, test_stream_->playback_handle_); |
219 EXPECT_FALSE(test_stream_->packet_.get()); | 219 EXPECT_FALSE(test_stream_->packet_.get()); |
220 EXPECT_TRUE(test_stream_->stop_stream_); | 220 EXPECT_TRUE(test_stream_->stop_stream_); |
221 } | 221 } |
222 | 222 |
223 TEST_F(AlsaPcmOutputStreamTest, PcmOpenFailed) { | 223 TEST_F(AlsaPcmOutputStreamTest, PcmOpenFailed) { |
224 EXPECT_CALL(mock_alsa_wrapper_, PcmOpen(_, _, _, _)) | 224 EXPECT_CALL(mock_alsa_wrapper_, PcmOpen(_, _, _, _)) |
225 .WillOnce(Return(kTestFailedErrno)); | 225 .WillOnce(Return(kTestFailedErrno)); |
226 EXPECT_CALL(mock_alsa_wrapper_, StrError(kTestFailedErrno)) | 226 EXPECT_CALL(mock_alsa_wrapper_, StrError(kTestFailedErrno)) |
227 .WillOnce(Return(kDummyMessage)); | 227 .WillOnce(Return(kDummyMessage)); |
228 | 228 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 410 |
411 test_stream_->stop_stream_ = true; | 411 test_stream_->stop_stream_ = true; |
412 test_stream_->ScheduleNextWrite(&packet_); | 412 test_stream_->ScheduleNextWrite(&packet_); |
413 | 413 |
414 // TODO(ajwong): Find a way to test whether or not another task has been | 414 // TODO(ajwong): Find a way to test whether or not another task has been |
415 // posted so we can verify that the Alsa code will indeed break the task | 415 // posted so we can verify that the Alsa code will indeed break the task |
416 // posting loop. | 416 // posting loop. |
417 | 417 |
418 test_stream_->shared_data_.TransitionTo(AlsaPcmOutputStream::kIsClosed); | 418 test_stream_->shared_data_.TransitionTo(AlsaPcmOutputStream::kIsClosed); |
419 } | 419 } |
OLD | NEW |