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

Unified Diff: tools/telemetry/telemetry/web_perf/metrics/timeline_based_metric_unittest.py

Issue 273103003: Add responsiveness_metric for timeline_based_measurement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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/web_perf/metrics/timeline_based_metric_unittest.py
diff --git a/tools/telemetry/telemetry/web_perf/metrics/timeline_based_metric_unittest.py b/tools/telemetry/telemetry/web_perf/metrics/timeline_based_metric_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..a2a176e2e20cdd0365de82f089ea8d424db1cc82
--- /dev/null
+++ b/tools/telemetry/telemetry/web_perf/metrics/timeline_based_metric_unittest.py
@@ -0,0 +1,27 @@
+# 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 unittest
+
+import telemetry.web_perf.metrics.timeline_based_metric as tbm_module
+
+class TimelineBasedMetricTest(unittest.TestCase):
+
+ # pylint: disable=W0212
+ def testTimeRangesHasOverlap(self):
+ # Test cases with overlap on one side
+ self.assertTrue(tbm_module._TimeRangesHasOverlap([(10, 20), (5, 15)]))
+ self.assertTrue(tbm_module._TimeRangesHasOverlap([(5, 15), (10, 20)]))
+ self.assertTrue(tbm_module._TimeRangesHasOverlap(
+ [(5, 15), (25, 30), (10, 20)]))
+
+ # Test cases with one range fall in the middle of other
+ self.assertTrue(tbm_module._TimeRangesHasOverlap([(10, 20), (15, 18)]))
+ self.assertTrue(tbm_module._TimeRangesHasOverlap([(15, 18), (10, 20)]))
+ self.assertTrue(tbm_module._TimeRangesHasOverlap(
+ [(15, 18), (40, 50), (10, 20)]))
+
+ self.assertFalse(tbm_module._TimeRangesHasOverlap([(15, 18), (20, 25)]))
+ self.assertFalse(tbm_module._TimeRangesHasOverlap(
+ [(1, 2), (2, 3), (0, 1)]))

Powered by Google App Engine
This is Rietveld 408576698