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

Side by Side Diff: tools/perf/benchmarks/system_health_unittest.py

Issue 2199333005: [tools/perf] Add unittests coverage for system health benchmarks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Petr's nits Created 4 years, 4 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
« no previous file with comments | « tools/perf/benchmarks/system_health.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 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
5 import sys
6 import unittest
7
8 from benchmarks import system_health as system_health_benchmark
9 from core import path_util
10 from page_sets.system_health import system_health_stories
11
12 from telemetry import benchmark as benchmark_module
13 from telemetry.core import discover
14
15
16 def _GetAllSystemHealthBenchmarks():
17 all_perf_benchmarks = discover.DiscoverClasses(
18 path_util.GetPerfBenchmarksDir(), path_util.GetPerfDir(),
19 benchmark_module.Benchmark,
20 index_by_class_name=True).values()
21 return [b for b in all_perf_benchmarks if
22 sys.modules[b.__module__] == system_health_benchmark]
23
24
25 class TestSystemHealthBenchmarks(unittest.TestCase):
26
27 def testNaming(self):
petrcermak 2016/08/03 15:47:27 nit: testNamePrefix might be better?
nednguyen 2016/08/03 17:50:06 Done.
28 for b in _GetAllSystemHealthBenchmarks():
29 self.assertTrue(
30 b.Name().startswith('system_health.'),
31 '%r must have name started with "system_health." prefix' % b)
petrcermak 2016/08/03 15:47:27 nit: s/started/starting/
nednguyen 2016/08/03 17:50:06 Done.
32
33 def testShouldTearDownStateAfterEachStoryRunIsTrue(self):
34 for b in _GetAllSystemHealthBenchmarks():
35 self.assertTrue(
36 b.ShouldTearDownStateAfterEachStoryRun(),
37 '%r has ShouldTearDownStateAfterEachStoryRun set to False' % b)
38
39 def testSystemHealthStorySetAreUsed(self):
petrcermak 2016/08/03 15:47:27 nit: s/Are/Is/
nednguyen 2016/08/03 17:50:06 Done.
40 for b in _GetAllSystemHealthBenchmarks():
41 if b is system_health_benchmark.WebviewStartupSystemHealthBenchmark:
42 continue
43 self.assertIsInstance(
44 b().CreateStorySet(None),
45 system_health_stories.SystemHealthStorySet,
46 '%r does not use SystemHealthStorySet' % b)
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/system_health.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698