| OLD | NEW |
| 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 | 4 |
| 5 """For all the benchmarks that set options, test that the options are valid.""" | 5 """For all the benchmarks that set options, test that the options are valid.""" |
| 6 | 6 |
| 7 from collections import defaultdict | 7 from collections import defaultdict |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 from core import path_util | 10 from core import path_util |
| 11 from core import perf_benchmark | 11 from core import perf_benchmark |
| 12 | 12 |
| 13 from telemetry import benchmark as benchmark_module | 13 from telemetry import benchmark as benchmark_module |
| 14 from telemetry import decorators | 14 from telemetry import decorators |
| 15 from telemetry.core import discover | |
| 16 from telemetry.internal.browser import browser_options | 15 from telemetry.internal.browser import browser_options |
| 17 from telemetry.testing import progress_reporter | 16 from telemetry.testing import progress_reporter |
| 18 | 17 |
| 18 from py_utils import discover |
| 19 | 19 |
| 20 def _GetAllPerfBenchmarks(): | 20 def _GetAllPerfBenchmarks(): |
| 21 return discover.DiscoverClasses( | 21 return discover.DiscoverClasses( |
| 22 path_util.GetPerfBenchmarksDir(), path_util.GetPerfDir(), | 22 path_util.GetPerfBenchmarksDir(), path_util.GetPerfDir(), |
| 23 benchmark_module.Benchmark, index_by_class_name=True).values() | 23 benchmark_module.Benchmark, index_by_class_name=True).values() |
| 24 | 24 |
| 25 | 25 |
| 26 def _BenchmarkOptionsTestGenerator(benchmark): | 26 def _BenchmarkOptionsTestGenerator(benchmark): |
| 27 def testBenchmarkOptions(self): # pylint: disable=unused-argument | 27 def testBenchmarkOptions(self): # pylint: disable=unused-argument |
| 28 """Invalid options will raise benchmark.InvalidOptionsError.""" | 28 """Invalid options will raise benchmark.InvalidOptionsError.""" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 suite.addTest(BenchmarkOptionsTest(benchmark.Name())) | 97 suite.addTest(BenchmarkOptionsTest(benchmark.Name())) |
| 98 | 98 |
| 99 | 99 |
| 100 def load_tests(loader, standard_tests, pattern): | 100 def load_tests(loader, standard_tests, pattern): |
| 101 del loader, pattern # unused | 101 del loader, pattern # unused |
| 102 suite = progress_reporter.TestSuite() | 102 suite = progress_reporter.TestSuite() |
| 103 for t in standard_tests: | 103 for t in standard_tests: |
| 104 suite.addTests(t) | 104 suite.addTests(t) |
| 105 _AddBenchmarkOptionsTests(suite) | 105 _AddBenchmarkOptionsTests(suite) |
| 106 return suite | 106 return suite |
| OLD | NEW |