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

Unified Diff: chrome/test/mini_installer/path_resolver.py

Issue 23757002: Check whether Chromium or Google Chrome is being tested. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Make GetProductName private. Created 7 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/mini_installer/path_resolver.py
diff --git a/chrome/test/mini_installer/path_resolver.py b/chrome/test/mini_installer/path_resolver.py
index 27f2d1dda49ee716ad22770942be7eb7a248de53..3cc178deec55504c0bfe2c4445b2ee9b014f7877 100644
--- a/chrome/test/mini_installer/path_resolver.py
+++ b/chrome/test/mini_installer/path_resolver.py
@@ -9,6 +9,25 @@ import win32com.client
from win32com.shell import shell, shellcon
+def _GetProductName(file_path):
+ """Returns the product name of the given file.
+
+ Args:
+ file_path: The absolute or relative path to the file.
+
+ Returns:
+ A string representing the product name of the file, or None if the product
+ name was not found.
+ """
+ language_and_codepage_pairs = win32api.GetFileVersionInfo(
+ file_path, '\\VarFileInfo\\Translation')
+ if not language_and_codepage_pairs:
+ return None
+ product_name_entry = ('\\StringFileInfo\\%04x%04x\\ProductName' %
+ language_and_codepage_pairs[0])
+ return win32api.GetFileVersionInfo(file_path, product_name_entry)
+
+
def ResolvePath(path):
"""Resolves variables in a file path, and returns the resolved path.
@@ -41,19 +60,21 @@ def ResolvePath(path):
mini_installer_path = os.path.abspath('mini_installer.exe')
mini_installer_file_version = win32com.client.Dispatch(
'Scripting.FileSystemObject').GetFileVersion(mini_installer_path)
- # TODO(sukolsak): Check whether this is Chrome or Chromium.
- is_chrome = True
- if is_chrome:
+ mini_installer_product_name = _GetProductName(mini_installer_path)
+ if mini_installer_product_name == 'Google Chrome':
chrome_short_name = 'Chrome'
chrome_long_name = 'Google Chrome'
chrome_dir = 'Google\\Chrome'
chrome_update_registry_subkey = ('Software\\Google\\Update\\Clients\\'
'{8A69D345-D564-463c-AFF1-A69D9E530F96}')
- else:
+ elif mini_installer_product_name == 'Chromium':
chrome_short_name = 'Chromium'
chrome_long_name = 'Chromium'
chrome_dir = 'Chromium'
chrome_update_registry_subkey = 'Software\\Chromium'
+ else:
+ raise KeyError("Unknown mini_installer product name '%s'" %
+ mini_installer_product_name)
variable_mapping = {
'PROGRAM_FILES': program_files_path,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698