• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5from __future__ import annotations
6
7from typing import TYPE_CHECKING
8
9from crossbench import plt
10
11if TYPE_CHECKING:
12  from crossbench.path import AnyPath
13
14
15class ChromePathMixin:
16
17  @classmethod
18  def default_path(cls, platform: plt.Platform) -> AnyPath:
19    return cls.stable_path(platform)
20
21  @classmethod
22  def stable_path(cls, platform: plt.Platform) -> AnyPath:
23    return platform.search_app_or_executable(
24        "Chrome Stable",
25        macos=["Google Chrome.app"],
26        linux=["google-chrome", "chrome"],
27        win=["Google/Chrome/Application/chrome.exe"])
28
29  @classmethod
30  def beta_path(cls, platform: plt.Platform) -> AnyPath:
31    return platform.search_app_or_executable(
32        "Chrome Beta",
33        macos=["Google Chrome Beta.app"],
34        linux=["google-chrome-beta"],
35        win=["Google/Chrome Beta/Application/chrome.exe"])
36
37  @classmethod
38  def dev_path(cls, platform: plt.Platform) -> AnyPath:
39    return platform.search_app_or_executable(
40        "Chrome Dev",
41        macos=["Google Chrome Dev.app"],
42        linux=["google-chrome-unstable"],
43        win=["Google/Chrome Dev/Application/chrome.exe"])
44
45  @classmethod
46  def canary_path(cls, platform: plt.Platform) -> AnyPath:
47    return platform.search_app_or_executable(
48        "Chrome Canary",
49        macos=["Google Chrome Canary.app"],
50        win=["Google/Chrome SxS/Application/chrome.exe"])
51
52  @property
53  def type_name(self) -> str:
54    return "chrome"
55