| 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 optparse | 8 import optparse |
| 9 import logging | 9 import logging |
| 10 import unittest | 10 import unittest |
| 11 | 11 |
| 12 from measurements import rasterize_and_record_micro | |
| 13 | |
| 14 from telemetry import benchmark as benchmark_module | 12 from telemetry import benchmark as benchmark_module |
| 15 from telemetry.core import discover | 13 from telemetry.core import discover |
| 16 from telemetry.page import page_test | 14 from telemetry.page import page_test |
| 17 from telemetry.unittest_util import options_for_unittests | 15 from telemetry.unittest_util import options_for_unittests |
| 18 from telemetry.util import classes | 16 from telemetry.util import classes |
| 19 from telemetry.web_perf import timeline_based_measurement | 17 from telemetry.web_perf import timeline_based_measurement |
| 20 | 18 |
| 21 | 19 |
| 22 # Do NOT add new items to this list! | 20 # Do NOT add new items to this list! |
| 23 # crbug.com/418375 | 21 # crbug.com/418375 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 page_test_instances.append(pt) | 57 page_test_instances.append(pt) |
| 60 | 58 |
| 61 return page_test_instances | 59 return page_test_instances |
| 62 | 60 |
| 63 | 61 |
| 64 class MeasurementSmokeTest(unittest.TestCase): | 62 class MeasurementSmokeTest(unittest.TestCase): |
| 65 # TODO(nednguyen): Remove this test when crbug.com/418375 is marked fixed. | 63 # TODO(nednguyen): Remove this test when crbug.com/418375 is marked fixed. |
| 66 def testNoNewActionNameToRunUsed(self): | 64 def testNoNewActionNameToRunUsed(self): |
| 67 invalid_tests = [] | 65 invalid_tests = [] |
| 68 for test in _GetAllPossiblePageTestInstances(): | 66 for test in _GetAllPossiblePageTestInstances(): |
| 69 if isinstance(test, rasterize_and_record_micro.RasterizeAndRecordMicro): | |
| 70 continue | |
| 71 if not hasattr(test, 'action_name_to_run'): | 67 if not hasattr(test, 'action_name_to_run'): |
| 72 invalid_tests.append(test) | 68 invalid_tests.append(test) |
| 73 logging.error('Test %s missing action_name_to_run attribute.', | 69 logging.error('Test %s missing action_name_to_run attribute.', |
| 74 test.__class__.__name__) | 70 test.__class__.__name__) |
| 75 if test.action_name_to_run not in _ACTION_NAMES_WHITE_LIST: | 71 if test.action_name_to_run not in _ACTION_NAMES_WHITE_LIST: |
| 76 invalid_tests.append(test) | 72 invalid_tests.append(test) |
| 77 logging.error('Page test %s has invalid action_name_to_run: %s' % | 73 logging.error('Page test %s has invalid action_name_to_run: %s' % |
| 78 (test.__class__.__name__, repr(test.action_name_to_run))) | 74 (test.__class__.__name__, repr(test.action_name_to_run))) |
| 79 self.assertFalse( | 75 self.assertFalse( |
| 80 invalid_tests, | 76 invalid_tests, |
| 81 'New page tests with invalid action_name_to_run found. Please only use ' | 77 'New page tests with invalid action_name_to_run found. Please only use ' |
| 82 'action_name_to_run="RunPageInteractions" (crbug.com/418375).') | 78 'action_name_to_run="RunPageInteractions" (crbug.com/418375).') |
| OLD | NEW |