Files
wine-access/tests/browser/publisher_snapshot_test.sh
Storm DragonandClaude Opus 5.5 9c1fc644ba Add browser accessibility for Chromium windows
Chromium-based Windows applications under Wine (Electron, CEF) exposed only
what the legacy MSAA path could announce, one event at a time. The helper now
starts a publisher for each Chromium window: a PE worker reads the page
through MSAA and IAccessible2 inside the prefix, and a native ATK publisher
presents it on the accessibility bus as toolkit Chromium, matching native
Linux Chromium, so the reader's own browser support handles browse mode,
structural navigation, forms, tables and live regions. Once a window is
published, legacy announcements for it stop, so nothing is spoken twice; if
the publisher fails, the window returns to the legacy path and the helper
retries with backoff. Publishers follow the helper's lifetime.

The publisher marks itself with WINE_ACCESS_BROWSER_PUBLISHER=1 and gives each
frame a wine-access-x11-window attribute so readers can verify window
ownership. Password text, values and boundaries never leave the worker.
Design, mapping rules and verification are in docs/browser.md; the
IAccessible2 IDL is vendored in third_party/ia2.

Checked: xvfb-run ctest (all 10, including the new
browser-publisher-snapshot comparison with native Chromium 158 and Electron
42), menu_integration.py with the menu and edit fixtures, the Orca extension
unit tests, and tests/browser/live_checks.sh against Electron 45: worker
protocol, helper lifecycle (publish, no legacy announcements while typing,
restart, no orphans), and live tree, text boundaries and AT-SPI event
sequence matching native Chromium. A live test with Cthulhu on Electron 45
read the fixture page correctly.

Remaining live checks: Orca with the extension, Firefox, WebView2, 32-bit
browsers, iframes, and window switching under other window managers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 23:15:21 -05:00

63 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# CTest: publish the recorded Electron 45 snapshot with the browser publisher
# on a private accessibility bus, and compare what readers would see with
# native Linux Chromium: the document with text boundaries against Chromium
# 158, and the whole application against Electron 42. No Wine is needed.
# Usage: publisher_snapshot_test.sh PUBLISHER
set -u
if [[ $# -ne 1 || ! -x "$1" ]]; then
echo "Usage: $0 PUBLISHER"
exit 2
fi
publisher="$1"
testDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
dataDir="$testDir/data"
workDir="$(mktemp -d)"
trap 'rm -rf "$workDir"' EXIT
export publisher testDir dataDir workDir
# shellcheck disable=SC2016 # expanded by the inner shell
timeout 180 "$testDir/private_session.sh" bash -c '
"$publisher" "$dataDir/electron45-snapshot.json" --active > "$workDir/publisher.log" 2>&1 &
publisherPid=$!
python3 -I "$testDir/atspi_dump.py" --app-name electron --boundaries > "$workDir/document.txt" 2>&1
python3 -I "$testDir/atspi_dump.py" --app-name electron --whole-app > "$workDir/application.txt" 2>&1
kill "$publisherPid" 2> /dev/null
wait "$publisherPid" 2> /dev/null
exit 0
' 2> "$workDir/session.log"
sessionStatus=$?
if [[ "$sessionStatus" -ne 0 ]]; then
echo "FAIL: private session (status $sessionStatus)"
cat "$workDir/session.log"
exit 1
fi
failures=0
if python3 -I "$testDir/compare_dumps.py" "$dataDir/native-chromium158-document.txt" "$workDir/document.txt" \
> "$workDir/document.diff"; then
echo "PASS: document and text boundaries match native Chromium 158"
else
echo "FAIL: document differs from native Chromium 158"
tail -n 40 "$workDir/document.diff"
failures=$((failures + 1))
fi
if python3 -I "$testDir/compare_dumps.py" "$dataDir/native-electron42-application.txt" "$workDir/application.txt" \
--baseline electron42 > "$workDir/application.diff"; then
echo "PASS: application matches native Electron 42"
else
echo "FAIL: application differs from native Electron 42"
tail -n 40 "$workDir/application.diff"
failures=$((failures + 1))
fi
if grep -q -E 'WARNING|CRITICAL' "$workDir/publisher.log"; then
echo "FAIL: publisher warnings"
grep -E 'WARNING|CRITICAL' "$workDir/publisher.log" | head -n 10
failures=$((failures + 1))
else
echo "PASS: no publisher warnings"
fi
[[ "$failures" -eq 0 ]]