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

Unified Diff: content/test/gpu/gpu_tests/hardware_accelerated_feature.py

Issue 48713005: Added test to check that GPU features are listed as hardware accelerated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Feedback Created 7 years, 2 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
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/hardware_accelerated_feature_expectations.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/gpu/gpu_tests/hardware_accelerated_feature.py
diff --git a/content/test/gpu/gpu_tests/hardware_accelerated_feature.py b/content/test/gpu/gpu_tests/hardware_accelerated_feature.py
new file mode 100644
index 0000000000000000000000000000000000000000..a42459b20a498ab1669ce3043578b13a65fec344
--- /dev/null
+++ b/content/test/gpu/gpu_tests/hardware_accelerated_feature.py
@@ -0,0 +1,69 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import hardware_accelerated_feature_expectations as expectations
+
+from telemetry import test
+from telemetry.page import page_set
+from telemetry.page import page_test
+
+test_harness_script = r"""
+ function VerifyHardwareAccelerated(feature) {
+ feature += ': '
+ var list = document.querySelector('.feature-status-list');
+ for (var i=0; i < list.childElementCount; i++) {
+ var span_list = list.children[i].getElementsByTagName('span');
+ var feature_str = span_list[0].textContent;
+ var value_str = span_list[1].textContent;
+ if ((feature_str == feature) &&
+ (value_str == 'Hardware accelerated')) {
+ return true;
+ }
+ }
+ return false;
+ };
+""";
+
+class HardwareAcceleratedFeatureValidator(page_test.PageTest):
+ def __init__(self):
+ super(HardwareAcceleratedFeatureValidator, self).__init__('ValidatePage')
+
+ def ValidatePage(self, page, tab, results):
+ feature = page.feature
+ if not tab.EvaluateJavaScript('VerifyHardwareAccelerated("%s")' % feature):
+ raise page_test.Failure('%s not hardware accelerated' % feature)
+
+def safe_feature_name(feature):
+ return feature.lower().replace(' ', '_')
+
+class HardwareAcceleratedFeature(test.Test):
+ """Tests GPU acceleration is reported as active for various features"""
+ test = HardwareAcceleratedFeatureValidator
+
+ def CreateExpectations(self, page_set):
+ return expectations.HardwareAcceleratedFeatureExpectations()
+
+ def CreatePageSet(self, options):
+ features = ['WebGL', 'Canvas', '3D CSS']
+
+ page_set_dict = {
+ 'description': 'Tests GPU acceleration is reported as active',
+ 'user_agent_type': 'desktop',
+ 'pages': []
+ }
+
+ pages = page_set_dict['pages']
+
+ for feature in features:
+ pages.append({
+ 'name': 'HardwareAcceleratedFeature.%s_accelerated' %
+ safe_feature_name(feature),
+ 'url': 'chrome://gpu',
+ 'navigate_steps': [
+ { "action": 'navigate' }
+ ],
+ 'script_to_evaluate_on_commit': test_harness_script,
+ 'feature': feature
+ })
+
+ return page_set.PageSet.FromDict(page_set_dict, '')
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/hardware_accelerated_feature_expectations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698