mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
Tests: Wait for PulseAudio context destruction in TestPlaybackStream
The stream was being kept alive until the moment before we check if the context is still alive. The stream's control thread holds a reference to the PulseAudioContext, so that should almost never be destroyed before the VERIFY in the test. Instead, wait at most 100ms for it to be destroyed.
This commit is contained in:
parent
69cede4a0f
commit
6790a695da
Notes:
github-actions[bot]
2025-11-25 19:15:24 +00:00
Author: https://github.com/Zaggy1024
Commit: 6790a695da
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6934
1 changed files with 7 additions and 2 deletions
|
|
@ -38,10 +38,15 @@ TEST_CASE(create_and_destroy_playback_stream)
|
|||
return buffer.trim(writing_stream.offset());
|
||||
});
|
||||
EXPECT_EQ(!stream_result.is_error(), has_implementation);
|
||||
MUST(Core::System::sleep_ms(100));
|
||||
}
|
||||
|
||||
#if defined(HAVE_PULSEAUDIO)
|
||||
VERIFY(!Audio::PulseAudioContext::is_connected());
|
||||
// The PulseAudio context is kept alive by the PlaybackStream's control thread, which blocks on
|
||||
// some operations, so it won't necessarily be destroyed immediately.
|
||||
auto wait_start = MonotonicTime::now_coarse();
|
||||
while (Audio::PulseAudioContext::is_connected()) {
|
||||
if (MonotonicTime::now_coarse() - wait_start > AK::Duration::from_milliseconds(100))
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue