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
3 # found in the LICENSE file.
5 from telemetry
.page
import test_expectations
7 # Valid expectation conditions are:
10 # win, xp, vista, win7, mac, leopard, snowleopard, lion, mountainlion,
11 # mavericks, yosemite, linux, chromeos, android
14 # amd, arm, broadcom, hisilicon, intel, imagination, nvidia, qualcomm,
20 # Specific GPUs can be listed as a tuple with vendor name and device ID.
21 # Examples: ('nvidia', 0x1234), ('arm', 'Mali-T604')
22 # Device IDs must be paired with a GPU vendor.
24 # Sample usage in SetExpectations in subclasses:
25 # self.Fail('gl-enable-vertex-attrib.html',
26 # ['mac', 'amd', ('nvidia', 0x1234)], bug=123)
28 class GpuTestExpectations(test_expectations
.TestExpectations
):
29 def IsValidUserDefinedCondition(self
, condition
):
30 # Add support for d3d9 and d3d11-specific expectations.
31 if condition
in ('d3d9', 'd3d11'):
33 return super(GpuTestExpectations
,
34 self
).IsValidUserDefinedCondition(condition
)
36 def ModifiersApply(self
, platform
, gpu_info
, expectation
):
37 if not super(GpuTestExpectations
, self
).ModifiersApply(
38 platform
, gpu_info
, expectation
):
40 # We'll only get here if the OS and GPU matched the expectation.
42 if gpu_info
.aux_attributes
:
43 gl_renderer
= gpu_info
.aux_attributes
.get('gl_renderer')
45 if 'Direct3D11' in gl_renderer
:
47 elif 'Direct3D9' in gl_renderer
:
49 d3d_matches
= ((not expectation
.user_defined_conditions
) or
50 d3d_version
in expectation
.user_defined_conditions
)