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] |