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

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

Issue 1647513002: Delete tools/telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/single_event_unittest.py
diff --git a/tools/telemetry/telemetry/web_perf/metrics/single_event_unittest.py b/tools/telemetry/telemetry/web_perf/metrics/single_event_unittest.py
deleted file mode 100644
index f96ef9fbf34633b955e326dc2da6e0d15c9564f9..0000000000000000000000000000000000000000
--- a/tools/telemetry/telemetry/web_perf/metrics/single_event_unittest.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# 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
-
-from collections import namedtuple
-from telemetry.internal.results import page_test_results
-from telemetry.page import page
-from telemetry.web_perf.metrics import single_event
-from telemetry.web_perf import timeline_interaction_record
-
-TRACE_EVENT_NAME = 'FrameView::performLayout'
-METRIC_NAME = 'layout'
-FakeEventTuple = namedtuple(
- 'Event',
- 'start, end, name, duration, thread_duration, has_thread_timestamps')
-Interaction = timeline_interaction_record.TimelineInteractionRecord
-
-class SingleEventTestMetric(single_event._SingleEventMetric):
- def __init__(self):
- super(SingleEventTestMetric, self).__init__(TRACE_EVENT_NAME, METRIC_NAME)
-
-def GetSingleEventMetrics(events, interactions):
- results = page_test_results.PageTestResults()
- results.WillRunPage(page.Page('file://blank.html'))
- SingleEventTestMetric()._AddResultsInternal(events, interactions, results)
- return dict((value.name, value.values) for value in
- results.current_page_run.values)
-
-def FakeEvent(start, end, name=TRACE_EVENT_NAME):
- dur = end - start
- return FakeEventTuple(start, end, name, dur, dur, True)
-
-
-class SingleEventMetricUnitTest(unittest.TestCase):
- def testSingleEventMetric(self):
- events = [FakeEvent(0, 1),
- FakeEvent(9, 11),
- FakeEventTuple(10, 13, TRACE_EVENT_NAME, 3, 0, False),
- FakeEvent(20, 24),
- FakeEvent(21, 26),
- FakeEvent(29, 35),
- FakeEvent(30, 37),
- FakeEvent(40, 48),
- FakeEvent(41, 50),
- FakeEvent(10, 13, name='something'),
- FakeEvent(20, 24, name='FrameView::something'),
- FakeEvent(30, 37, name='SomeThing::performLayout'),
- FakeEvent(40, 48, name='something else')]
- interactions = [Interaction('interaction', 10, 20),
- Interaction('interaction', 30, 40)]
-
- self.assertFalse(GetSingleEventMetrics(events, []))
- self.assertFalse(GetSingleEventMetrics([], interactions))
-
- # The first event starts before the first interaction, so it is ignored.
- # The second event starts before the first interaction, so it is ignored.
- # The third event starts during the first interaction, and its duration is
- # 13 - 10 = 3.
- # The fourth event starts during the first interaction, and its duration is
- # 24 - 20 = 4.
- # The fifth event starts between the two interactions, so it is ignored.
- # The sixth event starts between the two interactions, so it is ignored.
- # The seventh event starts during the second interaction, and its duration
- # is 37 - 30 = 7.
- # The eighth event starts during the second interaction, and its duration is
- # 48 - 40 = 8.
- # The ninth event starts after the last interaction, so it is ignored.
- # The rest of the events have the wrong name, so they are ignored.
- self.assertEqual({METRIC_NAME: [3, 4, 7, 8]}, GetSingleEventMetrics(
- events, interactions))
« no previous file with comments | « tools/telemetry/telemetry/web_perf/metrics/single_event.py ('k') | tools/telemetry/telemetry/web_perf/metrics/smoothness.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698