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.
6 from telemetry
.page
import shared_page_state
8 class WebGLSupportedSharedState(shared_page_state
.SharedPageState
):
9 def CanRunOnBrowser(self
, browser_info
, page
):
10 assert hasattr(page
, 'skipped_gpus')
12 if not browser_info
.HasWebGLSupport():
13 logging
.warning('Browser does not support webgl, skipping test')
16 # Check the skipped GPUs list.
17 # Requires the page provide a "skipped_gpus" property.
18 browser
= browser_info
.browser
19 if browser
.supports_system_info
:
20 gpu_info
= browser
.GetSystemInfo().gpu
21 gpu_vendor
= self
._GetGpuVendorString
(gpu_info
)
22 if gpu_vendor
in page
.skipped_gpus
:
27 def _GetGpuVendorString(self
, gpu_info
):
29 primary_gpu
= gpu_info
.devices
[0]
31 vendor_string
= primary_gpu
.vendor_string
.lower()
32 vendor_id
= primary_gpu
.vendor_id
34 return vendor_string
.split(' ')[0]
35 elif vendor_id
== 0x10DE:
37 elif vendor_id
== 0x1002:
39 elif vendor_id
== 0x8086: