




















@@ -15,6 +15,7 @@ import {
1515decorateOpenClawProfile,
1616diagnoseChromeCdp,
1717ensureProfileCleanExit,
18+findChromeExecutableLinux,
1819findChromeExecutableMac,
1920findChromeExecutableWindows,
2021formatChromeCdpDiagnostic,
@@ -295,6 +296,38 @@ describe("browser chrome helpers", () => {
295296exists.mockRestore();
296297});
297298299+it("finds common Linux Chromium package paths", () => {
300+for (const target of [
301+"/usr/lib/chromium/chromium",
302+"/usr/lib/chromium-browser/chromium-browser",
303+]) {
304+const exists = mockExistsSync((pathValue) => pathValue === target);
305+const exe = findChromeExecutableLinux();
306+expect(exe).toEqual({ kind: "chromium", path: target });
307+exists.mockRestore();
308+}
309+});
310+311+it("finds common Linux /opt Chrome and Brave paths", () => {
312+const cases = [
313+{ kind: "chrome", path: "/opt/google/chrome/chrome" },
314+{ kind: "brave", path: "/opt/brave.com/brave/brave-browser" },
315+] as const;
316+317+for (const candidate of cases) {
318+const exists = mockExistsSync((pathValue) => pathValue === candidate.path);
319+const exe = findChromeExecutableLinux();
320+expect(exe).toEqual(candidate);
321+exists.mockRestore();
322+}
323+});
324+325+it("returns null when no Chrome candidate exists on Linux", () => {
326+const exists = vi.spyOn(fs, "existsSync").mockReturnValue(false);
327+expect(findChromeExecutableLinux()).toBeNull();
328+exists.mockRestore();
329+});
330+298331it("picks the first existing Chrome candidate on Windows", () => {
299332vi.stubEnv("LOCALAPPDATA", "C:\\Users\\Test\\AppData\\Local");
300333const exists = mockExistsSync((pathStr) => {
@@ -665,6 +698,17 @@ describe("chrome executables", () => {
665698path: "/usr/bin/google-chrome-unstable",
666699});
667700});
701+702+it("finds Linux Google Chrome under /opt", () => {
703+vi.spyOn(fs, "existsSync").mockImplementation((candidate) => {
704+return String(candidate) === "/opt/google/chrome/chrome";
705+});
706+707+expect(resolveGoogleChromeExecutableForPlatform("linux")).toEqual({
708+kind: "chrome",
709+path: "/opt/google/chrome/chrome",
710+});
711+});
668712});
669713670714describe("browser chrome launch args", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。