mesa gn build: suppress -Wstring-conversion warnings
[chromium-blink-merge.git] / content / test / gpu / gpu_tests / gpu_test_expectations.py
blob9991f7268115c94cddcd938940b21a02febd1b1a
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:
9 # Operating systems:
10 # win, xp, vista, win7, mac, leopard, snowleopard, lion, mountainlion,
11 # mavericks, yosemite, linux, chromeos, android
13 # GPU vendors:
14 # amd, arm, broadcom, hisilicon, intel, imagination, nvidia, qualcomm,
15 # vivante
17 # Direct3D status:
18 # d3d9, d3d11
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'):
32 return True
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):
39 return False
40 # We'll only get here if the OS and GPU matched the expectation.
41 d3d_version = ''
42 if gpu_info.aux_attributes:
43 gl_renderer = gpu_info.aux_attributes.get('gl_renderer')
44 if gl_renderer:
45 if 'Direct3D11' in gl_renderer:
46 d3d_version = 'd3d11'
47 elif 'Direct3D9' in gl_renderer:
48 d3d_version = 'd3d9'
49 d3d_matches = ((not expectation.user_defined_conditions) or
50 d3d_version in expectation.user_defined_conditions)
51 return d3d_matches