Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Unified Diff: tools/telemetry/telemetry/core/extension_to_load.py

Issue 16346003: Fix extension id calculation to take into account Windows encoding. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated crx_id windows unit test to escape backslash Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/crx_id/crx_id_unittest.py ('k') | tools/telemetry/telemetry/core/extension_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b5c50009451330f62dd4071c8c103f115b654332 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, browser_type, is_component=False):
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)
+ # 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.
+ self._is_win = (os.name == 'nt'
+ and not (browser_type.startswith('android')
+ or browser_type.startswith('cros')))
+
@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,
+ is_win_path=self._is_win)
@property
def path(self):
« no previous file with comments | « tools/crx_id/crx_id_unittest.py ('k') | tools/telemetry/telemetry/core/extension_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698