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
3 # found in the LICENSE file.
7 from telemetry
.core
import discover
11 def _GetGpuDir(*subdirs
):
12 gpu_dir
= os
.path
.dirname(os
.path
.dirname(__file__
))
13 return os
.path
.join(gpu_dir
, *subdirs
)
16 # Unit tests verifying invariants of classes in GpuTestBase.
19 class NoOverridesTest(unittest
.TestCase
):
20 def testValidatorBase(self
):
21 all_validators
= discover
.DiscoverClasses(
22 _GetGpuDir('gpu_tests'), _GetGpuDir(),
23 gpu_test_base
.ValidatorBase
,
24 index_by_class_name
=True).values()
25 self
.assertGreater(len(all_validators
), 0)
26 for validator
in all_validators
:
27 self
.assertEquals(gpu_test_base
.ValidatorBase
.ValidateAndMeasurePage
,
28 validator
.ValidateAndMeasurePage
,
29 'Class %s should not override ValidateAndMeasurePage'
32 def testPageBase(self
):
33 all_pages
= discover
.DiscoverClasses(
34 _GetGpuDir(), _GetGpuDir(),
35 gpu_test_base
.PageBase
,
36 index_by_class_name
=True).values()
37 self
.assertGreater(len(all_pages
), 0)
38 for page
in all_pages
:
39 self
.assertEquals(gpu_test_base
.PageBase
.RunNavigateSteps
,
40 page
.RunNavigateSteps
,
41 'Class %s should not override ValidateAndMeasurePage'
43 self
.assertEquals(gpu_test_base
.PageBase
.RunPageInteractions
,
44 page
.RunPageInteractions
,
45 'Class %s should not override RunPageInteractions'