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

Unified Diff: tools/telemetry/telemetry/page/page_measurement_results.py

Issue 22754003: Refactor BenchmarkResult.Add to take enum for data_type (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 3 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
Index: tools/telemetry/telemetry/page/page_measurement_results.py
===================================================================
--- tools/telemetry/telemetry/page/page_measurement_results.py (revision 222891)
+++ tools/telemetry/telemetry/page/page_measurement_results.py (working copy)
@@ -2,9 +2,15 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from telemetry.core import util
from telemetry.page import page_test_results
from telemetry.page import page_measurement_value
+# Get build scripts into our path.
+util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'build', 'util', 'lib')
+from common import perf_result_data_type # pylint: disable=F0401
+
+
class ValuesForSinglePage(object):
def __init__(self, page):
self.page = page
@@ -72,13 +78,14 @@
def all_measurements_that_have_been_seen(self):
return self._all_measurements_that_have_been_seen
- def Add(self, trace_name, units, value, chart_name=None, data_type='default'):
+ def Add(self, trace_name, units, value, chart_name=None,
+ data_type=perf_result_data_type.DEFAULT):
value = self._GetPageMeasurementValue(trace_name, units, value, chart_name,
data_type)
self._values_for_current_page.AddValue(value)
def AddSummary(self, trace_name, units, value, chart_name=None,
- data_type='default'):
+ data_type=perf_result_data_type.DEFAULT):
value = self._GetPageMeasurementValue(trace_name, units, value, chart_name,
data_type)
self._overall_results.append(value)
@@ -91,6 +98,8 @@
# Sanity checks.
assert measurement_name != 'url', 'The name url cannot be used'
+ assert perf_result_data_type.IsValidType(data_type), \
+ 'Data type must be a valid perf_result_data_type'
if measurement_name in self._all_measurements_that_have_been_seen:
measurement_data = \
self._all_measurements_that_have_been_seen[measurement_name]

Powered by Google App Engine
This is Rietveld 408576698