Files
wehub-resource-sync 542cfa195c
CI / Frontend build (push) Failing after 9m6s
CI / Plugin validate (push) Failing after 9m27s
CI / Python lint (push) Failing after 16m1s
CI / Tests (push) Successful in 18m0s
Deploy / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:33:27 +08:00

34 lines
1.2 KiB
Python

"""Cross-platform Chrome resolution candidates (logic is testable on any OS)."""
import os
from pixelrag_render.chrome import _candidate_chrome_paths, find_chrome
def test_macos_candidates_include_chrome_app():
paths = _candidate_chrome_paths("Darwin")
assert any("Google Chrome.app/Contents/MacOS/Google Chrome" in p for p in paths)
# No Linux system paths leak into the macOS candidate list.
assert "/usr/bin/google-chrome" not in paths
def test_windows_candidates_include_chrome_exe():
paths = _candidate_chrome_paths("Windows")
assert any(p.endswith("chrome.exe") and "Google" in p for p in paths)
def test_linux_candidates_include_system_chrome():
paths = _candidate_chrome_paths("Linux")
assert "/usr/bin/google-chrome" in paths
assert "/usr/bin/chromium" in paths
def test_chrome_path_env_is_first(monkeypatch):
monkeypatch.setenv("CHROME_PATH", "/custom/chrome")
assert _candidate_chrome_paths("Linux")[0] == "/custom/chrome"
def test_find_chrome_returns_executable():
# On any supported dev box this resolves to an installed/usable binary.
path = find_chrome()
assert os.path.isfile(path) and os.access(path, os.X_OK)