summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authoralyssad@chromium.org <alyssad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 16:52:07 +0000
committeralyssad@chromium.org <alyssad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 16:52:07 +0000
commit85e62c25afdf2834e8fef1a12e34d9d380c95ee9 (patch)
treedb164a5ff58c3edf9e7a44f87a8c5699c9073ea9 /chrome/test
parent90f189171992a626ee8f1f99e1ce418513bf18db (diff)
downloadchromium_src-85e62c25afdf2834e8fef1a12e34d9d380c95ee9.zip
chromium_src-85e62c25afdf2834e8fef1a12e34d9d380c95ee9.tar.gz
chromium_src-85e62c25afdf2834e8fef1a12e34d9d380c95ee9.tar.bz2
New PyAuto functional test: codesign test for Mac
Review URL: http://codereview.chromium.org/2868038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/functional/PYAUTO_TESTS1
-rw-r--r--chrome/test/functional/codesign.py54
2 files changed, 55 insertions, 0 deletions
diff --git a/chrome/test/functional/PYAUTO_TESTS b/chrome/test/functional/PYAUTO_TESTS
index fc4937b..87c70c3 100644
--- a/chrome/test/functional/PYAUTO_TESTS
+++ b/chrome/test/functional/PYAUTO_TESTS
@@ -24,6 +24,7 @@
'bookmark_bar',
'bookmarks',
'browser',
+ 'codesign',
'content',
'downloads',
'history',
diff --git a/chrome/test/functional/codesign.py b/chrome/test/functional/codesign.py
new file mode 100644
index 0000000..add2e73
--- /dev/null
+++ b/chrome/test/functional/codesign.py
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import commands
+import glob
+import logging
+import os
+import sys
+import unittest
+
+import pyauto_functional # Must import before pyauto
+import pyauto
+
+class CodesignTest(pyauto.PyUITest):
+ """Test if the build is code signed"""
+
+ def testCodeSign(self):
+ """Check the app for codesign and bail out if it's non-branded."""
+ browser_info = self.GetBrowserInfo()
+
+ # bail out if not a branded build
+ if browser_info['properties']['branding'] != 'Google Chrome':
+ return
+
+ # TODO: Add functionality for other operating systems (see crbug.com/47902)
+ if self.IsMac():
+ self._macCodeSign(browser_info)
+
+ def _MacCodeSign(self, browser_info):
+ valid_text = 'valid on disk'
+ app_name = 'Google Chrome.app'
+
+ # Codesign of the app @ xcodebuild/Release/Google Chrome.app/
+ app_path = browser_info['child_process_path']
+ app_path = app_path[:app_path.find(app_name)]
+ app_path = app_path + app_name
+ self.assertTrue(valid_text in self._checkCodeSign(app_path))
+
+ # Codesign of the frameWork
+ framework_path = glob.glob(os.path.join(app_path, 'Contents', 'Versions',
+ '*.*.*.*'))[0]
+ framework_path = os.path.join(framework_path,
+ 'Google Chrome Framework.framework')
+ self.assertTrue(valid_text in self._checkCodeSign(framework_path))
+
+ def _checkCodeSign(self, file_path):
+ """Return the output of the codesign"""
+ return commands.getoutput('codesign -vvv "%s"' % file_path)
+
+
+if __name__ == '__main__':
+ pyauto_functional.Main()