| 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', | |
| 23 'RunPageInteractions', | 22 'RunPageInteractions', |
| 24 'RunNavigateSteps', | 23 'RunNavigateSteps', |
| 25 ) | 24 ) |
| 26 | 25 |
| 27 | 26 |
| 28 def _GetAllPossiblePageTestInstances(): | 27 def _GetAllPossiblePageTestInstances(): |
| 29 page_test_instances = [] | 28 page_test_instances = [] |
| 30 benchmarks_dir = os.path.dirname(__file__) | 29 benchmarks_dir = os.path.dirname(__file__) |
| 31 top_level_dir = os.path.dirname(benchmarks_dir) | 30 top_level_dir = os.path.dirname(benchmarks_dir) |
| 32 measurements_dir = os.path.join(top_level_dir, 'measurements') | 31 measurements_dir = os.path.join(top_level_dir, 'measurements') |
| (...skipping 25 matching lines...) Expand all Loading... |
| 58 invalid_tests = [] | 57 invalid_tests = [] |
| 59 for test in _GetAllPossiblePageTestInstances(): | 58 for test in _GetAllPossiblePageTestInstances(): |
| 60 if test.action_name_to_run not in _ACTION_NAMES_WHITE_LIST: | 59 if test.action_name_to_run not in _ACTION_NAMES_WHITE_LIST: |
| 61 invalid_tests.append(test) | 60 invalid_tests.append(test) |
| 62 logging.error('Page test %s has invalid action_name_to_run: %s' % | 61 logging.error('Page test %s has invalid action_name_to_run: %s' % |
| 63 (test.__class__.__name__, test.action_name_to_run)) | 62 (test.__class__.__name__, test.action_name_to_run)) |
| 64 self.assertFalse( | 63 self.assertFalse( |
| 65 invalid_tests, | 64 invalid_tests, |
| 66 'New page tests with invalid action_name_to_run found. Please only use ' | 65 'New page tests with invalid action_name_to_run found. Please only use ' |
| 67 'action_name_to_run="RunPageInteractions" (crbug.com/418375).') | 66 'action_name_to_run="RunPageInteractions" (crbug.com/418375).') |
| OLD | NEW |