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

Unified Diff: tools/perf/metrics/keychain_metric.py

Issue 809473004: Make Telemetry tests check the configuration of the OSX Keychain. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove gyp targets. Created 5 years, 10 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 | tools/telemetry/bin/mac/x86_64/determine_if_keychain_entry_is_decryptable.sha1 » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/keychain_metric.py
diff --git a/tools/perf/metrics/keychain_metric.py b/tools/perf/metrics/keychain_metric.py
index 5657dfe985bb78177111956a917d9b32122a3c31..a2c89fa92ef80851a0a223c54f7d47f78b8caed0 100644
--- a/tools/perf/metrics/keychain_metric.py
+++ b/tools/perf/metrics/keychain_metric.py
@@ -2,9 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import logging
import sys
from metrics import Metric
+from telemetry.util.mac import keychain_helper
from telemetry.value import histogram_util
from telemetry.value import scalar
@@ -18,6 +20,36 @@ class KeychainMetric(Metric):
DISPLAY_NAME = 'OSX_Keychain_Access'
HISTOGRAM_NAME = 'OSX.Keychain.Access'
+ @staticmethod
+ def _CheckKeychainConfiguration():
+ """
+ On OSX, it is possible for a misconfigured keychain to cause the
+ Telemetry tests to stall. This method confirms that the keychain is in a
+ sane state that will not cause this behavior. Three conditions are checked:
+ - The keychain is unlocked.
+ - The keychain will not auto-lock after a period of time.
+ - The ACLs are correctly configured on the relevant keychain items.
+ """
+ warning_suffix = ('which will cause some Telemetry tests to stall when run'
+ ' on a headless machine (e.g. perf bot).')
+ if keychain_helper.IsKeychainLocked():
+ logging.warning('The default keychain is locked, %s', warning_suffix)
+
+ if keychain_helper.DoesKeychainHaveTimeout():
+ logging.warning('The default keychain is configured to automatically'
+ ' lock itself have a period of time, %s', warning_suffix)
+
+ chrome_acl_configured = (keychain_helper.
+ IsKeychainConfiguredForBotsWithChrome())
+ chromium_acl_configured = (keychain_helper.
+ IsKeychainConfiguredForBotsWithChromium())
+ acl_warning = ('A commonly used %s key stored in the default keychain does'
+ ' not give decryption access to all applications, %s')
+ if not chrome_acl_configured:
+ logging.warning(acl_warning, 'Chrome', warning_suffix)
+ if not chromium_acl_configured:
+ logging.warning(acl_warning, 'Chromium', warning_suffix)
+
@classmethod
def CustomizeBrowserOptions(cls, options):
"""Adds a browser argument that allows for the collection of keychain
@@ -25,6 +57,8 @@ class KeychainMetric(Metric):
if sys.platform != 'darwin':
return
+ KeychainMetric._CheckKeychainConfiguration()
+
options.AppendExtraBrowserArgs(['--enable-stats-collection-bindings'])
def AddResults(self, tab, results):
« no previous file with comments | « no previous file | tools/telemetry/bin/mac/x86_64/determine_if_keychain_entry_is_decryptable.sha1 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698