Chromium Code Reviews| Index: tools/telemetry/telemetry/core/extension_to_load.py |
| diff --git a/tools/telemetry/telemetry/core/extension_to_load.py b/tools/telemetry/telemetry/core/extension_to_load.py |
| index 2127fa686312246667ef77242bb41fc88403e624..9bc0a4e21ebfa80f575ff32aed13d2f8ff23da96 100644 |
| --- a/tools/telemetry/telemetry/core/extension_to_load.py |
| +++ b/tools/telemetry/telemetry/core/extension_to_load.py |
| @@ -12,7 +12,7 @@ class MissingPublicKeyException(Exception): |
| pass |
| class ExtensionToLoad(object): |
| - def __init__(self, path, is_component=False): |
| + def __init__(self, path, is_component=False, browser_type=None): |
|
achuithb
2013/06/04 18:33:29
perhaps browser_type should not have a default?
Tim Song
2013/06/05 18:36:27
This is probably a good idea, so we don't get hard
|
| if not os.path.isdir(path): |
| raise ExtensionPathNonExistentException( |
| 'Extension path not a directory %s' % path) |
| @@ -23,6 +23,14 @@ class ExtensionToLoad(object): |
| raise MissingPublicKeyException( |
| 'Component extension %s must have a public key' % path) |
| + self._is_platform_windows = os.name == 'nt' |
|
achuithb
2013/06/04 18:33:29
Perhaps something shorter? is_win?
|
| + # It is possible that we are running telemetry on Windows targeting |
| + # a remote CrOS or Android device. In this case, we need the |
| + # browser_type argument to determine how we should encode |
| + # the extension path. |
| + if self._is_platform_windows and browser_type is not None: |
| + self._is_platform_windows = browser_type == 'system' |
|
achuithb
2013/06/04 18:33:29
This doesn't seem right? What if browser_type is d
tonyg
2013/06/04 18:40:16
Elsewhere we've used:
not browser_type.startswith(
Tim Song
2013/06/05 18:36:27
Done.
|
| + |
| @property |
| def extension_id(self): |
| """Unique extension id of this extension.""" |
| @@ -31,8 +39,10 @@ class ExtensionToLoad(object): |
| return crx_id.GetCRXAppID(os.path.realpath(self._path)) |
| else: |
| # Calculate extension id based on the path on the device. |
| - return crx_id.GetCRXAppID(os.path.realpath(self._local_path), |
| - from_file_path=True) |
| + return crx_id.GetCRXAppID( |
| + os.path.realpath(self._local_path), |
| + from_file_path=True, |
| + encode_path_for_windows=self._is_platform_windows) |
| @property |
| def path(self): |