kiosk watchdog: require a visible window, kill orphans, refuse SYSTEM

This commit is contained in:
2026-08-10 09:03:31 -04:00
parent d9d08f53ac
commit acadddb917
2 changed files with 70 additions and 8 deletions

View File

@@ -180,3 +180,26 @@ def test_watchdog_does_nothing_without_a_kiosk_shortcut():
script = build_watchdog_script()
assert 'ShopDB Kiosk.lnk' in script
assert 'shopdb-kiosk-lastlaunch' in script # debounce stamp
def test_watchdog_requires_a_visible_window_not_just_a_process():
"""Edge can update and leave a --kiosk process behind with no window. The
first version tested the command line alone, so it saw 'kiosk is up' and
never relaunched - observed on a real display."""
script = build_watchdog_script()
assert 'MainWindowHandle' in script
def test_watchdog_kills_windowless_kiosk_before_relaunching():
"""Leaving the orphan would satisfy the next cycle's check again, and two
browsers would fight over the display."""
script = build_watchdog_script()
assert 'Stop-Process' in script
assert 'windowless' in script
def test_watchdog_refuses_to_run_as_system():
"""MainWindowHandle is session-scoped: SYSTEM reads 0 for a healthy kiosk,
so a mis-registered task would kill and relaunch the display every cycle."""
script = build_watchdog_script()
assert 'IsSystem' in script