ZaStoGram_desktop/Telegram/SourceFiles/test/test_launch_fuse.h
John Preston 4911100c2d [ai] Fuse real launches and assert document opens
Task: 2026/07/28/assert-open-hand-off-and-fuse-real-launches
2026-07-29 13:01:53 +04:00

31 lines
1.1 KiB
C++

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
namespace Test {
// One hand-off to the operating system that the fuse refused.
struct BlockedLaunch {
QString function;
QString argument;
};
// Returns true when the call must not reach the operating system, which is
// exactly when Active(). Records the attempt and fails the run, so a run
// that reaches a launcher can never pass quietly. Safe to call from
// anywhere: outside a test run it does nothing and returns false.
bool BlockLaunch(const QString &function, const QString &argument);
[[nodiscard]] const std::vector<BlockedLaunch> &BlockedLaunches();
// BlockLaunch already fails the run for every call it blocks, so this
// records a PASS when nothing was blocked and a Note listing the blocked
// calls otherwise, never a second failure for the same launch.
void CheckNoBlockedLaunches(const QString &what);
} // namespace Test