Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/browser_harness/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,16 +631,16 @@ def print_update_banner(out=None):


def _chrome_running():
"""Cross-platform best-effort check for a running Chrome/Edge process."""
"""Cross-platform best-effort check for a running Chromium-based browser."""
import platform, subprocess
system = platform.system()
try:
if system == "Windows":
out = subprocess.check_output(["tasklist"], text=True, timeout=5)
names = ("chrome.exe", "msedge.exe")
names = ("chrome.exe", "msedge.exe", "helium.exe")
else:
out = subprocess.check_output(["ps", "-A", "-o", "comm="], text=True, timeout=5)
names = ("Google Chrome", "chrome", "chromium", "Microsoft Edge", "msedge")
names = ("Google Chrome", "chrome", "chromium", "Microsoft Edge", "msedge", "helium")
return any(n.lower() in out.lower() for n in names)
except Exception:
return False
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ def test_browser_connections_returns_attached_page(monkeypatch):
]


def test_chrome_running_detects_helium_on_linux(monkeypatch):
monkeypatch.setattr("platform.system", lambda: "Linux")
monkeypatch.setattr(
"subprocess.check_output",
lambda *args, **kwargs: "systemd\nhelium\nxdg-desktop-portal\n",
)

assert admin._chrome_running()


def test_run_doctor_prints_active_browser_connections_and_active_pages(monkeypatch, capsys):
monkeypatch.setattr(admin, "_version", lambda: "0.1.0")
monkeypatch.setattr(admin, "_install_mode", lambda: "git")
Expand Down