| OLD | NEW |
| (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 testNamePrefix(self): |
| 28 for b in _GetAllSystemHealthBenchmarks(): |
| 29 self.assertTrue( |
| 30 b.Name().startswith('system_health.'), |
| 31 '%r must have name starting with "system_health." prefix' % b) |
| 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 testSystemHealthStorySetIsUsed(self): |
| 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) |
| OLD | NEW |