| 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 """Measurement smoke test to make sure that no new action_name_to_run is | 4 """Measurement smoke test to make sure that no new action_name_to_run is |
| 5 defined.""" | 5 defined.""" |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 import logging | 8 import logging |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| 11 from telemetry import benchmark as benchmark_module | 11 from telemetry import benchmark as benchmark_module |
| 12 from telemetry.core import discover | 12 from telemetry.core import discover |
| 13 from telemetry.page import page_test | 13 from telemetry.page import page_test |
| 14 from telemetry.unittest_util import options_for_unittests | 14 from telemetry.unittest_util import options_for_unittests |
| 15 from telemetry.util import classes | 15 from telemetry.util import classes |
| 16 | 16 |
| 17 | 17 |
| 18 # Do NOT add new items to this list! | 18 # Do NOT add new items to this list! |
| 19 # crbug.com/418375 | 19 # crbug.com/418375 |
| 20 _ACTION_NAMES_WHITE_LIST = ( | 20 _ACTION_NAMES_WHITE_LIST = ( |
| 21 '', | 21 '', |
| 22 'RunSmoothness', |
| 22 'RunPageInteractions', | 23 'RunPageInteractions', |
| 23 'RunSmoothness', | |
| 24 'RunRepaint', | |
| 25 'RunNavigateSteps', | 24 'RunNavigateSteps', |
| 26 ) | 25 ) |
| 27 | 26 |
| 28 | 27 |
| 29 def _GetAllPossiblePageTestInstances(): | 28 def _GetAllPossiblePageTestInstances(): |
| 30 page_test_instances = [] | 29 page_test_instances = [] |
| 31 benchmarks_dir = os.path.dirname(__file__) | 30 benchmarks_dir = os.path.dirname(__file__) |
| 32 top_level_dir = os.path.dirname(benchmarks_dir) | 31 top_level_dir = os.path.dirname(benchmarks_dir) |
| 33 measurements_dir = os.path.join(top_level_dir, 'measurements') | 32 measurements_dir = os.path.join(top_level_dir, 'measurements') |
| 34 | 33 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 59 invalid_tests = [] | 58 invalid_tests = [] |
| 60 for test in _GetAllPossiblePageTestInstances(): | 59 for test in _GetAllPossiblePageTestInstances(): |
| 61 if test.action_name_to_run not in _ACTION_NAMES_WHITE_LIST: | 60 if test.action_name_to_run not in _ACTION_NAMES_WHITE_LIST: |
| 62 invalid_tests.append(test) | 61 invalid_tests.append(test) |
| 63 logging.error('Page test %s has invalid action_name_to_run: %s' % | 62 logging.error('Page test %s has invalid action_name_to_run: %s' % |
| 64 (test.__class__.__name__, test.action_name_to_run)) | 63 (test.__class__.__name__, test.action_name_to_run)) |
| 65 self.assertFalse( | 64 self.assertFalse( |
| 66 invalid_tests, | 65 invalid_tests, |
| 67 'New page tests with invalid action_name_to_run found. Please only use ' | 66 'New page tests with invalid action_name_to_run found. Please only use ' |
| 68 'action_name_to_run="RunPageInteractions" (crbug.com/418375).') | 67 'action_name_to_run="RunPageInteractions" (crbug.com/418375).') |
| OLD | NEW |