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

Side by Side Diff: tools/perf/measurements/thread_times_unittest.py

Issue 208643007: Add cleanup for measurements that use tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 from measurements import thread_times 4 from measurements import thread_times
5 from telemetry.core import wpr_modes 5 from telemetry.core import wpr_modes
6 from telemetry.page import page_measurement_unittest_base 6 from telemetry.page import page_measurement_unittest_base
7 from telemetry.unittest import options_for_unittests 7 from telemetry.unittest import options_for_unittests
8 from metrics import timeline 8 from metrics import timeline
9 9
10 class ThreadTimesUnitTest( 10 class ThreadTimesUnitTest(
11 page_measurement_unittest_base.PageMeasurementUnitTestBase): 11 page_measurement_unittest_base.PageMeasurementUnitTestBase):
12 def setUp(self): 12 def setUp(self):
13 self._options = options_for_unittests.GetCopy() 13 self._options = options_for_unittests.GetCopy()
14 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF 14 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF
15 15
16 def testBasic(self): 16 def testBasic(self):
17 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html') 17 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html')
18 measurement = thread_times.ThreadTimes() 18 measurement = thread_times.ThreadTimes()
19 timeline_options = self._options 19 timeline_options = self._options
20 results = self.RunMeasurement(measurement, ps, options = timeline_options) 20 results = self.RunMeasurement(measurement, ps, options = timeline_options)
21 self.assertEquals(0, len(results.failures)) 21 self.assertEquals(0, len(results.failures))
22 22
23 for category in timeline.TimelineThreadCategories.values(): 23 for category in timeline.TimelineThreadCategories.values():
24 cpu_time_name = timeline.ThreadCpuTimeResultName(category) 24 cpu_time_name = timeline.ThreadCpuTimeResultName(category)
25 cpu_time = results.FindAllPageSpecificValuesNamed(cpu_time_name) 25 cpu_time = results.FindAllPageSpecificValuesNamed(cpu_time_name)
26 self.assertEquals(len(cpu_time), 1) 26 self.assertEquals(len(cpu_time), 1)
27
28 def testCleanUpTrace(self):
29 self.TestTracingCleanedUp(thread_times.ThreadTimes, self._options)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698