Fix import error in mac_platform_backend.py
[chromium-blink-merge.git] / tools / perf / measurements / thread_times_unittest.py
blobfa9214498b318d9fbf3fcfc7a8213dc0277b9c0e
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 from measurements import thread_times
5 from telemetry.core import wpr_modes
6 from telemetry.page import page_measurement_unittest_base
7 from telemetry.unittest import options_for_unittests
8 from metrics import timeline
10 class ThreadTimesUnitTest(
11 page_measurement_unittest_base.PageMeasurementUnitTestBase):
12 def setUp(self):
13 self._options = options_for_unittests.GetCopy()
14 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF
16 def testBasic(self):
17 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html')
18 measurement = thread_times.ThreadTimes()
19 timeline_options = self._options
20 results = self.RunMeasurement(measurement, ps, options = timeline_options)
21 self.assertEquals(0, len(results.failures))
23 for category in timeline.TimelineThreadCategories.values():
24 clock_time_name = timeline.ThreadTimeResultName(category)
25 clock_time = results.FindAllPageSpecificValuesNamed(clock_time_name)
26 self.assertEquals(len(clock_time), 1)
28 cpu_time_name = timeline.ThreadCpuTimeResultName(category)
29 cpu_time = results.FindAllPageSpecificValuesNamed(cpu_time_name)
30 self.assertEquals(len(cpu_time), 1)