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

Unified Diff: tools/perf/measurements/__init__.py

Issue 714273004: mac: Expose keychain access frequency to Telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mock_keychain_sleep
Patch Set: Add a common subclass to measurements. Created 6 years, 1 month 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
Index: tools/perf/measurements/__init__.py
diff --git a/tools/perf/measurements/__init__.py b/tools/perf/measurements/__init__.py
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..33d038e9f73442f5e07507e4ade193289fd98559 100644
--- a/tools/perf/measurements/__init__.py
+++ b/tools/perf/measurements/__init__.py
@@ -0,0 +1,34 @@
+# Copyright 2014 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 sys
+
+from metrics import keychain_metric
+from telemetry.page import page_test
+
+class PageTestMeasurement(page_test.PageTest):
jeremy 2014/11/13 11:31:30 I'd just add the flag and stat as part of the info
erikchen 2014/11/13 18:11:09 I'm not sure that I understand your comment. I tho
+ """Base class for all telemetry measurements based on page_test."""
+
+ def __init__(self, *args, **kwargs):
+ super(PageTestMeasurement, self).__init__(*args, **kwargs)
+ self._in_unit_test = False
+
+ def CustomizeBrowserOptions(self, options):
+ """When subclasses override this method, they must still call this class's
+ implementation.
+ """
+ if sys.platform == 'darwin' and not self._in_unit_test:
+ options.AppendExtraBrowserArgs([
+ '--enable-stats-collection-bindings'
jeremy 2014/11/13 11:31:30 Is there a reason we need to collect this for test
erikchen 2014/11/13 22:52:59 Yes, as per our offline discussion. We will want a
+ ])
+
+ def ValidateAndMeasurePage(self, page, tab, results):
+ """When subclasses override this method, they must still call this class's
+ implementation.
+ """
+ if sys.platform == 'darwin' and not self._in_unit_test:
+ keychain_metric.KeychainMetric().AddResults(tab, results)
+
+ def SetInUnitTest(self):
+ self._in_unit_test = True

Powered by Google App Engine
This is Rietveld 408576698