diff options
author | henrika <henrika@webrtc.org> | 2016-01-07 15:02:53 +0100 |
---|---|---|
committer | henrika <henrika@webrtc.org> | 2016-01-07 14:03:07 +0000 |
commit | 46ea3ce5802f76bdd9177ec495cbc581bf021313 (patch) | |
tree | 6d42f00abb3e33e53cabc6aac529fe376ba323ac /webrtc/modules | |
parent | a49ad9856ba20421dcc9f7cd7680eecc1e9935e6 (diff) | |
download | webrtc-46ea3ce5802f76bdd9177ec495cbc581bf021313.tar.gz |
AudioDeviceTest.StartPlayoutOnTwoInstances now verifies two active playing streams
TBR=tkchin_webrtc
BUG=b/25343768
Review URL: https://codereview.webrtc.org/1527143007 .
Cr-Commit-Position: refs/heads/master@{#11165}
Diffstat (limited to 'webrtc/modules')
-rw-r--r-- | webrtc/modules/audio_device/ios/audio_device_unittest_ios.cc | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/webrtc/modules/audio_device/ios/audio_device_unittest_ios.cc b/webrtc/modules/audio_device/ios/audio_device_unittest_ios.cc index 8993aceea4..1c9746fdbf 100644 --- a/webrtc/modules/audio_device/ios/audio_device_unittest_ios.cc +++ b/webrtc/modules/audio_device/ios/audio_device_unittest_ios.cc @@ -428,7 +428,9 @@ class MockAudioTransport : public AudioTransport { audio_stream_->Write(audioSamples, nSamples); } if (ReceivedEnoughCallbacks()) { - test_is_done_->Set(); + if (test_is_done_) { + test_is_done_->Set(); + } } return 0; } @@ -450,7 +452,9 @@ class MockAudioTransport : public AudioTransport { audio_stream_->Read(audioSamples, nSamples); } if (ReceivedEnoughCallbacks()) { - test_is_done_->Set(); + if (test_is_done_) { + test_is_done_->Set(); + } } return 0; } @@ -638,7 +642,9 @@ TEST_F(AudioDeviceTest, StopPlayoutRequiresInitToRestart) { // Verify that we can create two ADMs and start playing on the second ADM. // Only the first active instance shall activate an audio session and the -// last active instace shall deactivate the audio session. +// last active instance shall deactivate the audio session. The test does not +// explicitly verify correct audio session calls but instead focuses on +// ensuring that audio starts for both ADMs. TEST_F(AudioDeviceTest, StartPlayoutOnTwoInstances) { // Create and initialize a second/extra ADM instance. The default ADM is // created by the test harness. @@ -647,8 +653,16 @@ TEST_F(AudioDeviceTest, StartPlayoutOnTwoInstances) { EXPECT_NE(second_audio_device.get(), nullptr); EXPECT_EQ(0, second_audio_device->Init()); - // Start playout for the default ADM. Ignore the callback sequence. + // Start playout for the default ADM but don't wait here. Instead use the + // upcoming second stream for that. We set the same expectation on number + // of callbacks as for the second stream. NiceMock<MockAudioTransport> mock(kPlayout); + mock.HandleCallbacks(nullptr, nullptr, 0); + EXPECT_CALL( + mock, NeedMorePlayData(playout_frames_per_10ms_buffer(), kBytesPerSample, + playout_channels(), playout_sample_rate(), + NotNull(), _, _, _)) + .Times(AtLeast(kNumCallbacks)); EXPECT_EQ(0, audio_device()->RegisterAudioCallback(&mock)); StartPlayout(); @@ -660,13 +674,10 @@ TEST_F(AudioDeviceTest, StartPlayoutOnTwoInstances) { EXPECT_EQ(0, second_audio_device->InitPlayout()); EXPECT_TRUE(second_audio_device->PlayoutIsInitialized()); - // Stop playout for the default ADM. The audio session shall not be - // deactivated since it is used by the second ADM. - StopPlayout(); - // Start playout for the second ADM and verify that it starts as intended. // Passing this test ensures that initialization of the second audio unit - // has been done successfully. + // has been done successfully and that there is no conflict with the already + // playing first ADM. MockAudioTransport mock2(kPlayout); mock2.HandleCallbacks(test_is_done_.get(), nullptr, kNumCallbacks); EXPECT_CALL( |