Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: tools/telemetry/telemetry/page/test_expectations.py

Issue 22909011: Added support for GPU-based expectations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/page/test_expectations.py
diff --git a/tools/telemetry/telemetry/page/test_expectations.py b/tools/telemetry/telemetry/page/test_expectations.py
index 2ed9faa30a0215bd22a2dfe10ee518fa827018ad..d439cd3dd99e4a18dc3a5bf16ffa868c66611e0a 100644
--- a/tools/telemetry/telemetry/page/test_expectations.py
+++ b/tools/telemetry/telemetry/page/test_expectations.py
@@ -54,19 +54,45 @@ class TestExpectations(object):
self.expectations.append(Expectation(expectation, url_pattern, conditions,
bug))
- def GetExpectationForPage(self, platform, page):
+ def GetExpectationForPage(self, state, page):
+ platform = state.browser.platform
+ gpu_info = None
+ if state.browser.supports_system_info:
+ gpu_info = state.browser.GetSystemInfo().gpu
+
for e in self.expectations:
if fnmatch.fnmatch(page.url, e.url_pattern):
- if self._ModifiersApply(platform, e):
+ if self._ModifiersApply(platform, gpu_info, e):
return e.expectation
return 'pass'
- def _ModifiersApply(self, platform, expectation):
+ def _GetGpuVendorString(self, gpu_info):
+ if gpu_info:
+ primary_gpu = gpu_info.devices[0]
+ if primary_gpu:
+ vendor_string = primary_gpu.vendor_string.lower()
+ vendor_id = primary_gpu.vendor_id
+ if vendor_string:
+ return vendor_string
+ elif vendor_id == 0x10DE:
+ return 'nvidia'
+ elif vendor_id == 0x1002:
+ return 'amd'
+ elif vendor_id == 0x8086:
+ return 'intel'
+
+ return 'unknown_gpu'
+
+ def _ModifiersApply(self, platform, gpu_info, expectation):
"""Determines if the conditions for an expectation apply to this system."""
os_matches = (not expectation.os_conditions or
- platform.GetOSName() in expectation.os_conditions or
- platform.GetOSVersionName() in expectation.os_conditions)
+ platform.GetOSName() in expectation.os_conditions or
+ platform.GetOSVersionName() in expectation.os_conditions)
+
+ vendor_string = self._GetGpuVendorString(gpu_info)
+ gpu_matches = (not expectation.gpu_conditions or
+ vendor_string in expectation.gpu_conditions)
- # TODO: Add checks against other modifiers (GPU, configuration, etc.)
+ # TODO: Add checks against other modifiers (configuration, etc.)
Ken Russell (switch to Gerrit) 2013/08/15 19:25:28 Rather than delaying the work, please pull in all
- return os_matches
+ return os_matches and gpu_matches

Powered by Google App Engine
This is Rietveld 408576698