Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/stringprintf.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" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 uint8* dest, uint32 max_size, | 71 uint8* dest, uint32 max_size, |
| 72 AudioBuffersState buffers_state)); | 72 AudioBuffersState buffers_state)); |
| 73 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); | 73 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 class MockAudioManagerLinux : public AudioManagerLinux { | 76 class MockAudioManagerLinux : public AudioManagerLinux { |
| 77 public: | 77 public: |
| 78 MOCK_METHOD0(Init, void()); | 78 MOCK_METHOD0(Init, void()); |
| 79 MOCK_METHOD0(HasAudioOutputDevices, bool()); | 79 MOCK_METHOD0(HasAudioOutputDevices, bool()); |
| 80 MOCK_METHOD0(HasAudioInputDevices, bool()); | 80 MOCK_METHOD0(HasAudioInputDevices, bool()); |
| 81 MOCK_METHOD1(MakeAudioOutputStream, AudioOutputStream*( | |
| 82 const AudioParameters& params)); | |
| 83 MOCK_METHOD2(MakeAudioInputStream, AudioInputStream*( | |
| 84 const AudioParameters& params, const std::string& device_id)); | |
| 85 MOCK_METHOD0(MuteAll, void()); | 81 MOCK_METHOD0(MuteAll, void()); |
| 86 MOCK_METHOD0(UnMuteAll, void()); | 82 MOCK_METHOD0(UnMuteAll, void()); |
| 87 MOCK_METHOD1(ReleaseOutputStream, void(AudioOutputStream* stream)); | 83 MOCK_METHOD0(GetMaxAudioOutputStreamsAllowed, int()); |
| 84 MOCK_METHOD1(MakeAudioLinearOutputStream, AudioOutputStream*( | |
| 85 const AudioParameters& params)); | |
| 86 MOCK_METHOD1(MakeAudioLowLatencyOutputStream, AudioOutputStream*( | |
| 87 const AudioParameters& params)); | |
| 88 MOCK_METHOD2(MakeAudioLinearOutputStream, AudioInputStream*( | |
| 89 const AudioParameters& params, const std::string& device_id)); | |
| 90 MOCK_METHOD2(MakeAudioLowLatencyInputStream, AudioInputStream*( | |
| 91 const AudioParameters& params, const std::string& device_id)); | |
| 92 | |
| 93 // We need to override this function because we want to skip the checking | |
| 94 // the number of active streams. | |
|
tommi (sloooow) - chröme
2012/03/05 14:28:28
nit: maybe a note on why we want to skip checking
| |
| 95 virtual void ReleaseOutputStream(AudioOutputStream* stream) OVERRIDE { | |
| 96 DCHECK(stream); | |
| 97 delete stream; | |
| 98 } | |
| 88 | 99 |
| 89 // We don't mock this method since all tests will do the same thing | 100 // We don't mock this method since all tests will do the same thing |
| 90 // and use the current message loop. | 101 // and use the current message loop. |
| 91 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE { | 102 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE { |
| 92 return MessageLoop::current()->message_loop_proxy(); | 103 return MessageLoop::current()->message_loop_proxy(); |
| 93 } | 104 } |
| 94 }; | 105 }; |
| 95 | 106 |
| 96 class AlsaPcmOutputStreamTest : public testing::Test { | 107 class AlsaPcmOutputStreamTest : public testing::Test { |
| 97 protected: | 108 protected: |
| 98 AlsaPcmOutputStreamTest() { | 109 AlsaPcmOutputStreamTest() { |
| 99 mock_manager_.reset(new StrictMock<MockAudioManagerLinux>()); | 110 mock_manager_.reset(new StrictMock<MockAudioManagerLinux>()); |
| 100 test_stream_.reset(CreateStream(kTestChannelLayout)); | 111 test_stream_.reset(CreateStream(kTestChannelLayout)); |
| 101 } | 112 } |
| 102 | 113 |
| 103 virtual ~AlsaPcmOutputStreamTest() { | 114 virtual ~AlsaPcmOutputStreamTest() { |
| 115 test_stream_->Close(); | |
| 104 test_stream_.reset(NULL); | 116 test_stream_.reset(NULL); |
| 105 } | 117 } |
| 106 | 118 |
| 107 AlsaPcmOutputStream* CreateStream(ChannelLayout layout) { | 119 AlsaPcmOutputStream* CreateStream(ChannelLayout layout) { |
| 108 return CreateStream(layout, kTestFramesPerPacket); | 120 return CreateStream(layout, kTestFramesPerPacket); |
| 109 } | 121 } |
| 110 | 122 |
| 111 AlsaPcmOutputStream* CreateStream(ChannelLayout layout, | 123 AlsaPcmOutputStream* CreateStream(ChannelLayout layout, |
| 112 int32 samples_per_packet) { | 124 int32 samples_per_packet) { |
| 113 AudioParameters params(kTestFormat, layout, kTestSampleRate, | 125 AudioParameters params(kTestFormat, layout, kTestSampleRate, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 static char kSurround41[]; | 170 static char kSurround41[]; |
| 159 static char kSurround50[]; | 171 static char kSurround50[]; |
| 160 static char kSurround51[]; | 172 static char kSurround51[]; |
| 161 static char kSurround70[]; | 173 static char kSurround70[]; |
| 162 static char kSurround71[]; | 174 static char kSurround71[]; |
| 163 static void* kFakeHints[]; | 175 static void* kFakeHints[]; |
| 164 | 176 |
| 165 StrictMock<MockAlsaWrapper> mock_alsa_wrapper_; | 177 StrictMock<MockAlsaWrapper> mock_alsa_wrapper_; |
| 166 scoped_ptr<StrictMock<MockAudioManagerLinux> > mock_manager_; | 178 scoped_ptr<StrictMock<MockAudioManagerLinux> > mock_manager_; |
| 167 MessageLoop message_loop_; | 179 MessageLoop message_loop_; |
| 168 scoped_ptr<AlsaPcmOutputStream> test_stream_; | 180 scoped_ptr<AlsaPcmOutputStream> test_stream_; |
|
tommi (sloooow) - chröme
2012/03/05 14:28:28
when we call test_stream_->Close(), won't that cau
| |
| 169 scoped_refptr<media::DataBuffer> packet_; | 181 scoped_refptr<media::DataBuffer> packet_; |
| 170 | 182 |
| 171 private: | 183 private: |
| 172 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStreamTest); | 184 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStreamTest); |
| 173 }; | 185 }; |
| 174 | 186 |
| 175 const ChannelLayout AlsaPcmOutputStreamTest::kTestChannelLayout = | 187 const ChannelLayout AlsaPcmOutputStreamTest::kTestChannelLayout = |
| 176 CHANNEL_LAYOUT_STEREO; | 188 CHANNEL_LAYOUT_STEREO; |
| 177 const int AlsaPcmOutputStreamTest::kTestSampleRate = | 189 const int AlsaPcmOutputStreamTest::kTestSampleRate = |
| 178 AudioParameters::kAudioCDSampleRate; | 190 AudioParameters::kAudioCDSampleRate; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 Return(0))); | 268 Return(0))); |
| 257 | 269 |
| 258 test_stream_.reset(CreateStream(kTestChannelLayout, | 270 test_stream_.reset(CreateStream(kTestChannelLayout, |
| 259 kPacketFramesInMinLatency)); | 271 kPacketFramesInMinLatency)); |
| 260 ASSERT_TRUE(test_stream_->Open()); | 272 ASSERT_TRUE(test_stream_->Open()); |
| 261 | 273 |
| 262 // Now close it and test that everything was released. | 274 // Now close it and test that everything was released. |
| 263 EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)).WillOnce(Return(0)); | 275 EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)).WillOnce(Return(0)); |
| 264 EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) | 276 EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) |
| 265 .WillOnce(Return(kTestDeviceName)); | 277 .WillOnce(Return(kTestDeviceName)); |
| 266 EXPECT_CALL(mock_manager(), ReleaseOutputStream(test_stream_.get())); | |
| 267 test_stream_->Close(); | 278 test_stream_->Close(); |
| 268 | 279 |
| 269 Mock::VerifyAndClear(&mock_alsa_wrapper_); | 280 Mock::VerifyAndClear(&mock_alsa_wrapper_); |
| 270 Mock::VerifyAndClear(mock_manager_.get()); | 281 Mock::VerifyAndClear(mock_manager_.get()); |
| 271 | 282 |
| 272 // Test that having more packets ends up with a latency based on packet size. | 283 // Test that having more packets ends up with a latency based on packet size. |
| 273 const int kOverMinLatencyPacketSize = kPacketFramesInMinLatency + 1; | 284 const int kOverMinLatencyPacketSize = kPacketFramesInMinLatency + 1; |
| 274 int64 expected_micros = 2 * AlsaPcmOutputStream::FramesToMicros( | 285 int64 expected_micros = 2 * AlsaPcmOutputStream::FramesToMicros( |
| 275 kOverMinLatencyPacketSize, kTestSampleRate); | 286 kOverMinLatencyPacketSize, kTestSampleRate); |
| 276 | 287 |
| 277 EXPECT_CALL(mock_alsa_wrapper_, PcmOpen(_, _, _, _)) | 288 EXPECT_CALL(mock_alsa_wrapper_, PcmOpen(_, _, _, _)) |
| 278 .WillOnce(DoAll(SetArgumentPointee<0>(kFakeHandle), Return(0))); | 289 .WillOnce(DoAll(SetArgumentPointee<0>(kFakeHandle), Return(0))); |
| 279 EXPECT_CALL(mock_alsa_wrapper_, | 290 EXPECT_CALL(mock_alsa_wrapper_, |
| 280 PcmSetParams(_, _, _, _, _, _, expected_micros)) | 291 PcmSetParams(_, _, _, _, _, _, expected_micros)) |
| 281 .WillOnce(Return(0)); | 292 .WillOnce(Return(0)); |
| 282 EXPECT_CALL(mock_alsa_wrapper_, PcmGetParams(_, _, _)) | 293 EXPECT_CALL(mock_alsa_wrapper_, PcmGetParams(_, _, _)) |
| 283 .WillOnce(DoAll(SetArgumentPointee<1>(kTestFramesPerPacket), | 294 .WillOnce(DoAll(SetArgumentPointee<1>(kTestFramesPerPacket), |
| 284 SetArgumentPointee<2>(kTestFramesPerPacket / 2), | 295 SetArgumentPointee<2>(kTestFramesPerPacket / 2), |
| 285 Return(0))); | 296 Return(0))); |
| 286 | 297 |
| 287 test_stream_.reset(CreateStream(kTestChannelLayout, | 298 test_stream_.reset(CreateStream(kTestChannelLayout, |
| 288 kOverMinLatencyPacketSize)); | 299 kOverMinLatencyPacketSize)); |
| 289 ASSERT_TRUE(test_stream_->Open()); | 300 ASSERT_TRUE(test_stream_->Open()); |
| 290 | 301 |
| 291 // Now close it and test that everything was released. | 302 // Now close it and test that everything was released. |
| 292 EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)) | 303 EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)) |
| 293 .WillOnce(Return(0)); | 304 .WillOnce(Return(0)); |
| 294 EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) | 305 EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) |
| 295 .WillOnce(Return(kTestDeviceName)); | 306 .WillOnce(Return(kTestDeviceName)); |
| 296 EXPECT_CALL(mock_manager(), ReleaseOutputStream(test_stream_.get())); | |
| 297 test_stream_->Close(); | 307 test_stream_->Close(); |
| 298 | 308 |
| 299 Mock::VerifyAndClear(&mock_alsa_wrapper_); | 309 Mock::VerifyAndClear(&mock_alsa_wrapper_); |
| 300 Mock::VerifyAndClear(mock_manager_.get()); | 310 Mock::VerifyAndClear(mock_manager_.get()); |
| 301 } | 311 } |
| 302 | 312 |
| 303 TEST_F(AlsaPcmOutputStreamTest, OpenClose) { | 313 TEST_F(AlsaPcmOutputStreamTest, OpenClose) { |
| 304 int64 expected_micros = 2 * | 314 int64 expected_micros = 2 * |
| 305 AlsaPcmOutputStream::FramesToMicros(kTestPacketSize / kTestBytesPerFrame, | 315 AlsaPcmOutputStream::FramesToMicros(kTestPacketSize / kTestBytesPerFrame, |
| 306 kTestSampleRate); | 316 kTestSampleRate); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 334 EXPECT_EQ(kFakeHandle, test_stream_->playback_handle_); | 344 EXPECT_EQ(kFakeHandle, test_stream_->playback_handle_); |
| 335 EXPECT_EQ(kTestFramesPerPacket, test_stream_->frames_per_packet_); | 345 EXPECT_EQ(kTestFramesPerPacket, test_stream_->frames_per_packet_); |
| 336 EXPECT_TRUE(test_stream_->buffer_.get()); | 346 EXPECT_TRUE(test_stream_->buffer_.get()); |
| 337 EXPECT_FALSE(test_stream_->stop_stream_); | 347 EXPECT_FALSE(test_stream_->stop_stream_); |
| 338 | 348 |
| 339 // Now close it and test that everything was released. | 349 // Now close it and test that everything was released. |
| 340 EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)) | 350 EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)) |
| 341 .WillOnce(Return(0)); | 351 .WillOnce(Return(0)); |
| 342 EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) | 352 EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) |
| 343 .WillOnce(Return(kTestDeviceName)); | 353 .WillOnce(Return(kTestDeviceName)); |
| 344 EXPECT_CALL(mock_manager(), ReleaseOutputStream(test_stream_.get())); | |
| 345 test_stream_->Close(); | 354 test_stream_->Close(); |
| 346 | |
| 347 EXPECT_TRUE(test_stream_->playback_handle_ == NULL); | |
| 348 EXPECT_FALSE(test_stream_->buffer_.get()); | |
| 349 EXPECT_TRUE(test_stream_->stop_stream_); | |
| 350 } | 355 } |
| 351 | 356 |
| 352 TEST_F(AlsaPcmOutputStreamTest, PcmOpenFailed) { | 357 TEST_F(AlsaPcmOutputStreamTest, PcmOpenFailed) { |
| 353 EXPECT_CALL(mock_alsa_wrapper_, PcmOpen(_, _, _, _)) | 358 EXPECT_CALL(mock_alsa_wrapper_, PcmOpen(_, _, _, _)) |
| 354 .WillOnce(Return(kTestFailedErrno)); | 359 .WillOnce(Return(kTestFailedErrno)); |
| 355 EXPECT_CALL(mock_alsa_wrapper_, StrError(kTestFailedErrno)) | 360 EXPECT_CALL(mock_alsa_wrapper_, StrError(kTestFailedErrno)) |
| 356 .WillOnce(Return(kDummyMessage)); | 361 .WillOnce(Return(kDummyMessage)); |
| 357 | 362 |
| 358 ASSERT_FALSE(test_stream_->Open()); | 363 ASSERT_FALSE(test_stream_->Open()); |
| 359 ASSERT_EQ(AlsaPcmOutputStream::kInError, test_stream_->state()); | 364 ASSERT_EQ(AlsaPcmOutputStream::kInError, test_stream_->state()); |
| 360 | 365 |
| 361 // Ensure internal state is set for a no-op stream if PcmOpen() failes. | 366 // Ensure internal state is set for a no-op stream if PcmOpen() failes. |
| 362 EXPECT_TRUE(test_stream_->stop_stream_); | 367 EXPECT_TRUE(test_stream_->stop_stream_); |
| 363 EXPECT_TRUE(test_stream_->playback_handle_ == NULL); | 368 EXPECT_TRUE(test_stream_->playback_handle_ == NULL); |
| 364 EXPECT_FALSE(test_stream_->buffer_.get()); | 369 EXPECT_FALSE(test_stream_->buffer_.get()); |
| 365 | 370 |
| 366 // Close the stream since we opened it to make destruction happy. | 371 // Close the stream since we opened it to make destruction happy. |
| 367 EXPECT_CALL(mock_manager(), ReleaseOutputStream(test_stream_.get())); | |
| 368 test_stream_->Close(); | 372 test_stream_->Close(); |
| 369 } | 373 } |
| 370 | 374 |
| 371 TEST_F(AlsaPcmOutputStreamTest, PcmSetParamsFailed) { | 375 TEST_F(AlsaPcmOutputStreamTest, PcmSetParamsFailed) { |
| 372 EXPECT_CALL(mock_alsa_wrapper_, PcmOpen(_, _, _, _)) | 376 EXPECT_CALL(mock_alsa_wrapper_, PcmOpen(_, _, _, _)) |
| 373 .WillOnce(DoAll(SetArgumentPointee<0>(kFakeHandle), | 377 .WillOnce(DoAll(SetArgumentPointee<0>(kFakeHandle), |
| 374 Return(0))); | 378 Return(0))); |
| 375 EXPECT_CALL(mock_alsa_wrapper_, PcmSetParams(_, _, _, _, _, _, _)) | 379 EXPECT_CALL(mock_alsa_wrapper_, PcmSetParams(_, _, _, _, _, _, _)) |
| 376 .WillOnce(Return(kTestFailedErrno)); | 380 .WillOnce(Return(kTestFailedErrno)); |
| 377 EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)) | 381 EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)) |
| 378 .WillOnce(Return(0)); | 382 .WillOnce(Return(0)); |
| 379 EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) | 383 EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) |
| 380 .WillOnce(Return(kTestDeviceName)); | 384 .WillOnce(Return(kTestDeviceName)); |
| 381 EXPECT_CALL(mock_alsa_wrapper_, StrError(kTestFailedErrno)) | 385 EXPECT_CALL(mock_alsa_wrapper_, StrError(kTestFailedErrno)) |
| 382 .WillOnce(Return(kDummyMessage)); | 386 .WillOnce(Return(kDummyMessage)); |
| 383 | 387 |
| 384 // If open fails, the stream stays in kCreated because it has effectively had | 388 // If open fails, the stream stays in kCreated because it has effectively had |
| 385 // no changes. | 389 // no changes. |
| 386 ASSERT_FALSE(test_stream_->Open()); | 390 ASSERT_FALSE(test_stream_->Open()); |
| 387 EXPECT_EQ(AlsaPcmOutputStream::kInError, test_stream_->state()); | 391 EXPECT_EQ(AlsaPcmOutputStream::kInError, test_stream_->state()); |
| 388 | 392 |
| 389 // Ensure internal state is set for a no-op stream if PcmSetParams() failes. | 393 // Ensure internal state is set for a no-op stream if PcmSetParams() failes. |
| 390 EXPECT_TRUE(test_stream_->stop_stream_); | 394 EXPECT_TRUE(test_stream_->stop_stream_); |
| 391 EXPECT_TRUE(test_stream_->playback_handle_ == NULL); | 395 EXPECT_TRUE(test_stream_->playback_handle_ == NULL); |
| 392 EXPECT_FALSE(test_stream_->buffer_.get()); | 396 EXPECT_FALSE(test_stream_->buffer_.get()); |
| 393 | 397 |
| 394 // Close the stream since we opened it to make destruction happy. | 398 // Close the stream since we opened it to make destruction happy. |
| 395 EXPECT_CALL(mock_manager(), ReleaseOutputStream(test_stream_.get())); | |
| 396 test_stream_->Close(); | 399 test_stream_->Close(); |
| 397 } | 400 } |
| 398 | 401 |
| 399 TEST_F(AlsaPcmOutputStreamTest, StartStop) { | 402 TEST_F(AlsaPcmOutputStreamTest, StartStop) { |
| 400 // Open() call opens the playback device, sets the parameters, posts a task | 403 // Open() call opens the playback device, sets the parameters, posts a task |
| 401 // with the resulting configuration data, and transitions the object state to | 404 // with the resulting configuration data, and transitions the object state to |
| 402 // kIsOpened. | 405 // kIsOpened. |
| 403 EXPECT_CALL(mock_alsa_wrapper_, PcmOpen(_, _, _, _)) | 406 EXPECT_CALL(mock_alsa_wrapper_, PcmOpen(_, _, _, _)) |
| 404 .WillOnce(DoAll(SetArgumentPointee<0>(kFakeHandle), | 407 .WillOnce(DoAll(SetArgumentPointee<0>(kFakeHandle), |
| 405 Return(0))); | 408 Return(0))); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 .Times(AtLeast(3)) | 443 .Times(AtLeast(3)) |
| 441 .WillOnce(Return(kTestFramesPerPacket)) // Buffer is empty. | 444 .WillOnce(Return(kTestFramesPerPacket)) // Buffer is empty. |
| 442 .WillOnce(Return(kTestFramesPerPacket)) | 445 .WillOnce(Return(kTestFramesPerPacket)) |
| 443 .WillRepeatedly(DoAll(InvokeWithoutArgs(&message_loop_, | 446 .WillRepeatedly(DoAll(InvokeWithoutArgs(&message_loop_, |
| 444 &MessageLoop::QuitNow), | 447 &MessageLoop::QuitNow), |
| 445 Return(0))); // Buffer is full. | 448 Return(0))); // Buffer is full. |
| 446 | 449 |
| 447 test_stream_->Start(&mock_callback); | 450 test_stream_->Start(&mock_callback); |
| 448 message_loop_.RunAllPending(); | 451 message_loop_.RunAllPending(); |
| 449 | 452 |
| 450 EXPECT_CALL(mock_manager(), ReleaseOutputStream(test_stream_.get())); | |
| 451 EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)) | 453 EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)) |
| 452 .WillOnce(Return(0)); | 454 .WillOnce(Return(0)); |
| 453 EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) | 455 EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle)) |
| 454 .WillOnce(Return(kTestDeviceName)); | 456 .WillOnce(Return(kTestDeviceName)); |
| 455 test_stream_->Close(); | 457 test_stream_->Close(); |
| 456 } | 458 } |
| 457 | 459 |
| 458 TEST_F(AlsaPcmOutputStreamTest, WritePacket_FinishedPacket) { | 460 TEST_F(AlsaPcmOutputStreamTest, WritePacket_FinishedPacket) { |
| 459 InitBuffer(); | 461 InitBuffer(); |
| 460 | 462 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 781 | 783 |
| 782 test_stream_->stop_stream_ = true; | 784 test_stream_->stop_stream_ = true; |
| 783 test_stream_->ScheduleNextWrite(true); | 785 test_stream_->ScheduleNextWrite(true); |
| 784 | 786 |
| 785 // TODO(ajwong): Find a way to test whether or not another task has been | 787 // TODO(ajwong): Find a way to test whether or not another task has been |
| 786 // posted so we can verify that the Alsa code will indeed break the task | 788 // posted so we can verify that the Alsa code will indeed break the task |
| 787 // posting loop. | 789 // posting loop. |
| 788 | 790 |
| 789 test_stream_->TransitionTo(AlsaPcmOutputStream::kIsClosed); | 791 test_stream_->TransitionTo(AlsaPcmOutputStream::kIsClosed); |
| 790 } | 792 } |
| OLD | NEW |