| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 | 4 |
| 5 import sys | 5 import sys |
| 6 import unittest | 6 import unittest |
| 7 | 7 |
| 8 from benchmarks import system_health as system_health_benchmark | 8 from benchmarks import system_health as system_health_benchmark |
| 9 from core import path_util | 9 from core import path_util |
| 10 from page_sets.system_health import system_health_stories | 10 from page_sets.system_health import system_health_stories |
| 11 from page_sets.system_health import system_health_story |
| 11 | 12 |
| 12 from telemetry import benchmark as benchmark_module | 13 from telemetry import benchmark as benchmark_module |
| 13 from telemetry.core import discover | 14 from telemetry.core import discover |
| 14 | 15 |
| 15 | 16 |
| 16 def _GetAllSystemHealthBenchmarks(): | 17 def _GetAllSystemHealthBenchmarks(): |
| 17 all_perf_benchmarks = discover.DiscoverClasses( | 18 all_perf_benchmarks = discover.DiscoverClasses( |
| 18 path_util.GetPerfBenchmarksDir(), path_util.GetPerfDir(), | 19 path_util.GetPerfBenchmarksDir(), path_util.GetPerfDir(), |
| 19 benchmark_module.Benchmark, | 20 benchmark_module.Benchmark, |
| 20 index_by_class_name=True).values() | 21 index_by_class_name=True).values() |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 '%r has ShouldTearDownStateAfterEachStoryRun set to False' % b) | 38 '%r has ShouldTearDownStateAfterEachStoryRun set to False' % b) |
| 38 | 39 |
| 39 def testSystemHealthStorySetIsUsed(self): | 40 def testSystemHealthStorySetIsUsed(self): |
| 40 for b in _GetAllSystemHealthBenchmarks(): | 41 for b in _GetAllSystemHealthBenchmarks(): |
| 41 if b is system_health_benchmark.WebviewStartupSystemHealthBenchmark: | 42 if b is system_health_benchmark.WebviewStartupSystemHealthBenchmark: |
| 42 continue | 43 continue |
| 43 self.assertIsInstance( | 44 self.assertIsInstance( |
| 44 b().CreateStorySet(None), | 45 b().CreateStorySet(None), |
| 45 system_health_stories.SystemHealthStorySet, | 46 system_health_stories.SystemHealthStorySet, |
| 46 '%r does not use SystemHealthStorySet' % b) | 47 '%r does not use SystemHealthStorySet' % b) |
| 48 |
| 49 |
| 50 class TestSystemHealthStories(unittest.TestCase): |
| 51 |
| 52 def testNoOverrideRunPageInteractions(self): |
| 53 desktop_stories = ( |
| 54 system_health_stories.DesktopSystemHealthStorySet().stories) |
| 55 mobile_stories = ( |
| 56 system_health_stories.MobileSystemHealthStorySet().stories) |
| 57 for s in desktop_stories + mobile_stories: |
| 58 # Long running stories has their own way of collecting memory dumps, |
| 59 # so they explicitly override RunPageInteractions method. |
| 60 if s.name.startswith('long_running:'): |
| 61 continue |
| 62 self.assertEquals(s.__class__.RunPageInteractions, |
| 63 system_health_story.SystemHealthStory.RunPageInteractions, |
| 64 'Story %s overrides RunPageInteractions. Override _DidLoadDocument ' |
| 65 'instead' % s.name) |
| OLD | NEW |