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

Side by Side Diff: content/test/gpu/gpu_tests/accelerated.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: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2012 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 accelerated_expectations
5
6 from telemetry import test
7 from telemetry.page import page_set
8 from telemetry.page import page_test
9
10 test_harness_script = r"""
11 function VerifyHardwareAccelerated(feature) {
12 feature += ': '
13 var list = document.querySelector('.feature-status-list');
14 for (var i=0; i < list.childElementCount; i++) {
15 var span_list = list.children[i].getElementsByTagName('span');
16 var feature_str = span_list[0].textContent;
17 var value_str = span_list[1].textContent;
18 if ((feature_str == feature) &&
19 (value_str == 'Hardware accelerated')) {
20 return true;
21 }
22 }
23 return false;
24 };
25 """;
26
27 class AcceleratedValidator(page_test.PageTest):
28 def __init__(self):
29 super(AcceleratedValidator, self).__init__('ValidatePage')
30
31 def ValidatePage(self, page, tab, results):
32 feature = page.feature
33 if not tab.EvaluateJavaScript('VerifyHardwareAccelerated("%s")' % feature):
34 raise page_test.Failure('%s not hardware accelerated' % feature)
35
36 def safe_feature_name(feature):
37 return feature.lower().replace(' ', '_')
38
39 class Accelerated(test.Test):
Ken Russell (switch to Gerrit) 2013/10/28 20:57:54 Please choose a more descriptive name. CheckHardwa
40 """Tests GPU acceleration is reported as active"""
41 test = AcceleratedValidator
42
43 def CreateExpectations(self, page_set):
44 return accelerated_expectations.AcceleratedExpectations()
45
46 def CreatePageSet(self, options):
47 features = ['WebGL', 'Canvas', '3D CSS']
48
49 page_set_dict = {
50 'description': 'Tests GPU acceleration is reported as active',
51 'user_agent_type': 'desktop',
52 'pages': []
53 }
54
55 pages = page_set_dict['pages']
56
57 for feature in features:
58 pages.append({
59 'name': 'Accelerated.%s_accelerated' % safe_feature_name(feature),
60 'url': 'chrome://gpu',
61 'navigate_steps': [
62 { "action": 'navigate' }
63 ],
64 'script_to_evaluate_on_commit': test_harness_script,
65 'feature': feature
66 })
67
68 return page_set.PageSet.FromDict(page_set_dict, '')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698