Fix OOP <webview> resize and autosize.
[chromium-blink-merge.git] / tools / perf / page_sets / webgl_supported_shared_state.py
blob9b34af7cef9818b9c0e1ec46782db42e6e08673a
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.
4 import logging
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')
14 return False
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:
23 return False
25 return True
27 def _GetGpuVendorString(self, gpu_info):
28 if gpu_info:
29 primary_gpu = gpu_info.devices[0]
30 if primary_gpu:
31 vendor_string = primary_gpu.vendor_string.lower()
32 vendor_id = primary_gpu.vendor_id
33 if vendor_string:
34 return vendor_string.split(' ')[0]
35 elif vendor_id == 0x10DE:
36 return 'nvidia'
37 elif vendor_id == 0x1002:
38 return 'amd'
39 elif vendor_id == 0x8086:
40 return 'intel'
42 return 'unknown_gpu'