-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIpcTests.cpp
More file actions
38 lines (28 loc) · 1 KB
/
Copy pathIpcTests.cpp
File metadata and controls
38 lines (28 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/// @file
/// @brief Unit tests for the launcher/DLL IPC signaling helper (shared/Ipc.h).
// Unit tests for the launcher/DLL IPC signaling helper (shared/Ipc.h). The named event is
// created, signaled and waited on within this single test process — no game required.
#include <gtest/gtest.h>
#include <Windows.h>
#include "Ipc.h"
namespace
{
TEST(IpcTest, NameIsStableAndSessionLocal)
{
EXPECT_STREQ(Ipc::Name(Ipc::Event::Initialized), L"Local\\SplitgateInitialized");
}
TEST(IpcTest, SignalWakesAWaiter)
{
HANDLE event = Ipc::Create(Ipc::Event::Initialized);
ASSERT_NE(event, nullptr);
EXPECT_FALSE(Ipc::Wait(event, 0)); // not signaled yet
EXPECT_TRUE(Ipc::Signal(Ipc::Event::Initialized));
EXPECT_TRUE(Ipc::Wait(event, 0)); // manual-reset stays signaled
CloseHandle(event);
}
TEST(IpcTest, SignalWithoutListenerReturnsFalse)
{
// No event exists (nothing created it) → OpenEventW fails → Signal reports false.
EXPECT_FALSE(Ipc::Signal(Ipc::Event::Initialized));
}
} // namespace