| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import os | 4 import os |
| 5 import unittest | 5 import unittest |
| 6 | 6 |
| 7 from core import benchmark_finders | 7 from core import benchmark_finders |
| 8 | 8 |
| 9 | 9 |
| 10 class TestGetBenchmarkNamesForFile(unittest.TestCase): | 10 class TestGetBenchmarkNamesForFile(unittest.TestCase): |
| 11 | 11 |
| 12 def setUp(self): | 12 def setUp(self): |
| 13 self.top_level_dir = os.path.abspath( | 13 self.top_level_dir = os.path.abspath( |
| 14 os.path.join(os.path.dirname(__file__), 'test_data')) | 14 os.path.join(os.path.dirname(__file__), 'test_data')) |
| 15 | 15 |
| 16 def testListSimpleBenchmarksDefinedInOneFile(self): | 16 def testListSimpleBenchmarksDefinedInOneFile(self): |
| 17 self.assertEquals( | 17 self.assertEquals( |
| 18 benchmark_finders.GetBenchmarkNamesForFile( | 18 benchmark_finders.GetBenchmarkNamesForFile( |
| 19 self.top_level_dir, | 19 self.top_level_dir, |
| 20 os.path.join( | 20 os.path.join( |
| 21 self.top_level_dir, | 21 self.top_level_dir, |
| 22 'simple_benchmarks_case.py')), | 22 'simple_benchmarks_case.py')), |
| 23 ['test_benchmark_1', 'test_benchmark_2', 'test_benchmark_subclass_1', | 23 ['test_benchmark_1', 'test_benchmark_2', 'test_benchmark_subclass_1', |
| 24 'test_benchmark_subclass_2']) | 24 'test_benchmark_subclass_2']) |
| 25 | 25 |
| 26 def testListSimpleBenchmarksDefinedInOneFile(self): | 26 def testListSimpleBenchmarksDefinedInOneFileComplex(self): |
| 27 self.assertEquals( | 27 self.assertEquals( |
| 28 benchmark_finders.GetBenchmarkNamesForFile( | 28 benchmark_finders.GetBenchmarkNamesForFile( |
| 29 self.top_level_dir, | 29 self.top_level_dir, |
| 30 os.path.join( | 30 os.path.join( |
| 31 self.top_level_dir, | 31 self.top_level_dir, |
| 32 'complex_benchmarks_case.py')), | 32 'complex_benchmarks_case.py')), |
| 33 ['test_benchmark_complex_1', 'test_benchmark_complex_subclass', | 33 ['test_benchmark_complex_1', 'test_benchmark_complex_subclass', |
| 34 'test_benchmark_complex_subclass_from_other_module']) | 34 'test_benchmark_complex_subclass_from_other_module']) |
| OLD | NEW |