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:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /ipc/ipdl/test/gtest/TestHangs.cpp
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/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();
}