summaryrefslogtreecommitdiffstats
path: root/ipc/ipdl/test/gtest/TestHangs.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /ipc/ipdl/test/gtest/TestHangs.cpp
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ipc/ipdl/test/gtest/TestHangs.cpp')
-rw-r--r--ipc/ipdl/test/gtest/TestHangs.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/ipc/ipdl/test/gtest/TestHangs.cpp b/ipc/ipdl/test/gtest/TestHangs.cpp
index ddc4a0c7d0..56f28c8afa 100644
--- a/ipc/ipdl/test/gtest/TestHangs.cpp
+++ b/ipc/ipdl/test/gtest/TestHangs.cpp
@@ -25,8 +25,7 @@ enum class HangMode : uint32_t {
/// The synchronous call should time out.
Hang,
/// The synchronous call should time out but the response should still be
- /// received
- /// (racing with the reply timeout logic).
+ /// received (racing with the reply timeout logic).
HangButReceive,
/// The synchronous call should time out but the response should still be
/// received because the child indicates that processing should continue after
@@ -50,8 +49,10 @@ class TestHangsChild : public PTestHangsChild {
this->hangMode = (HangMode)hangMode;
auto result = SendHang(hangMode, timeout->CloneHandle());
+ // Only the `Hang` mode should actually fail.
if (this->hangMode == HangMode::Hang) {
- // Only the `Hang` mode should actually fail.
+ // See description in parent.
+ timeout->Signal();
EXPECT_FALSE(result);
} else {
EXPECT_TRUE(result);
@@ -102,6 +103,13 @@ class TestHangsParent : public PTestHangsParent {
// Wait to ensure the child process has called
// ShouldContinueFromReplyTimeout().
timeout->Wait();
+
+ if (hangMode == (uint32_t)HangMode::Hang) {
+ // Wait to ensure the child process has returned from `SendHang()`,
+ // otherwise the reply message can race with the processing after
+ // ShouldContinueFromReplyTimeout().
+ timeout->Wait();
+ }
}
return IPC_OK();
}