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

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

Issue 1263063003: Revert of Create classes_util API, change discover to return a list instead of a dict. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 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 os 8 import os
9 import unittest 9 import unittest
10 10
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.core import discover
14 from telemetry.internal.browser import browser_options 15 from telemetry.internal.browser import browser_options
15 from telemetry.testing import progress_reporter 16 from telemetry.testing import progress_reporter
16 from telemetry.util import classes_util
17 17
18 18
19 def _GetPerfDir(*subdirs): 19 def _GetPerfDir(*subdirs):
20 perf_dir = os.path.dirname(os.path.dirname(__file__)) 20 perf_dir = os.path.dirname(os.path.dirname(__file__))
21 return os.path.join(perf_dir, *subdirs) 21 return os.path.join(perf_dir, *subdirs)
22 22
23 23
24 def _GetAllPerfBenchmarks(): 24 def _GetAllPerfBenchmarks():
25 return classes_util.DiscoverClasses( 25 return discover.DiscoverClasses(
26 _GetPerfDir('benchmarks'), _GetPerfDir(), benchmark_module.Benchmark) 26 _GetPerfDir('benchmarks'), _GetPerfDir(), benchmark_module.Benchmark,
27 index_by_class_name=True).values()
27 28
28 def _BenchmarkOptionsTestGenerator(benchmark): 29 def _BenchmarkOptionsTestGenerator(benchmark):
29 def testBenchmarkOptions(self): # pylint: disable=W0613 30 def testBenchmarkOptions(self): # pylint: disable=W0613
30 """Invalid options will raise benchmark.InvalidOptionsError.""" 31 """Invalid options will raise benchmark.InvalidOptionsError."""
31 options = browser_options.BrowserFinderOptions() 32 options = browser_options.BrowserFinderOptions()
32 parser = options.CreateParser() 33 parser = options.CreateParser()
33 benchmark.AddCommandLineArgs(parser) 34 benchmark.AddCommandLineArgs(parser)
34 benchmark_module.AddCommandLineArgs(parser) 35 benchmark_module.AddCommandLineArgs(parser)
35 benchmark.SetArgumentDefaults(parser) 36 benchmark.SetArgumentDefaults(parser)
36 return testBenchmarkOptions 37 return testBenchmarkOptions
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 suite.addTest(BenchmarkOptionsTest(benchmark.Name())) 77 suite.addTest(BenchmarkOptionsTest(benchmark.Name()))
77 suite.addTest(TestNoBenchmarkNamesDuplication()) 78 suite.addTest(TestNoBenchmarkNamesDuplication())
78 suite.addTest(TestNoOverrideCustomizeBrowserOptions()) 79 suite.addTest(TestNoOverrideCustomizeBrowserOptions())
79 80
80 81
81 def load_tests(loader, standard_tests, pattern): 82 def load_tests(loader, standard_tests, pattern):
82 del loader, standard_tests, pattern # unused 83 del loader, standard_tests, pattern # unused
83 suite = progress_reporter.TestSuite() 84 suite = progress_reporter.TestSuite()
84 _AddBenchmarkOptionsTests(suite) 85 _AddBenchmarkOptionsTests(suite)
85 return suite 86 return suite
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/benchmark_smoke_unittest.py ('k') | tools/perf/benchmarks/skpicture_printer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698