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

Unified Diff: tools/telemetry/telemetry/web_perf/timeline_based_measurement_unittest.py

Issue 965953002: [Telemetry] Output all timeline based metrics on all timeline interaction records (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Sami's comment 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 | « tools/telemetry/telemetry/web_perf/timeline_based_measurement.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/web_perf/timeline_based_measurement_unittest.py
diff --git a/tools/telemetry/telemetry/web_perf/timeline_based_measurement_unittest.py b/tools/telemetry/telemetry/web_perf/timeline_based_measurement_unittest.py
index e676811dbe7500eb4fccba6ceadd9003be0c54ee..fe7971b45112765604764f9e2c828c00c7086933 100644
--- a/tools/telemetry/telemetry/web_perf/timeline_based_measurement_unittest.py
+++ b/tools/telemetry/telemetry/web_perf/timeline_based_measurement_unittest.py
@@ -42,22 +42,6 @@ class FakeLoadingMetric(timeline_based_metric.TimelineBasedMetric):
len(interaction_records)))
-FAKE_METRICS_METRICS = {
- tir_module.IS_SMOOTH: FakeSmoothMetric,
- tir_module.IS_RESPONSIVE: FakeLoadingMetric,
-}
-
-
-def GetMetricFromFlags(record_custom_flags):
- flags_set = set(record_custom_flags)
- unknown_flags = flags_set.difference(FAKE_METRICS_METRICS)
- if unknown_flags:
- raise Exception("Unknown metric flags: %s" % sorted(unknown_flags))
-
- return [metric() for flag, metric in FAKE_METRICS_METRICS.iteritems()
- if flag in flags_set]
-
-
class TimelineBasedMetricTestData(object):
def __init__(self):
@@ -111,13 +95,21 @@ class TimelineBasedMetricTestData(object):
def AddResults(self):
for thread, records in self._threads_to_records_map.iteritems():
metric = tbm_module._TimelineBasedMetrics( # pylint: disable=W0212
- self._model, thread, records, GetMetricFromFlags)
+ self._model, thread, records)
metric.AddResults(self._results)
self._results.DidRunPage(self._ps.pages[0])
class TimelineBasedMetricsTests(unittest.TestCase):
+ def setUp(self):
+ self.actual_get_all_tbm_metrics = tbm_module._GetAllTimelineBasedMetrics
+ fake_tbm_metrics = (FakeSmoothMetric(), FakeLoadingMetric())
+ tbm_module._GetAllTimelineBasedMetrics = lambda: fake_tbm_metrics
+
+ def tearDown(self):
+ tbm_module._GetAllTimelineBasedMetrics = self.actual_get_all_tbm_metrics
+
def testGetRendererThreadsToInteractionRecordsMap(self):
d = TimelineBasedMetricTestData()
# Insert 2 interaction records to renderer_thread and 1 to foo_thread
« no previous file with comments | « tools/telemetry/telemetry/web_perf/timeline_based_measurement.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698