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

Side by Side Diff: content/test/gpu/gpu_tests/hardware_accelerated_feature.py

Issue 1413883003: Add a presubmit script and pylintrc for content/test/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address kbr's comments Created 5 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 unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 import gpu_test_base 4 from gpu_tests import gpu_test_base
5 import hardware_accelerated_feature_expectations as expectations 5 import gpu_tests.hardware_accelerated_feature_expectations as hw_expectations
6 6
7 from telemetry.page import page_test 7 from telemetry.page import page_test
8 from telemetry.story import story_set as story_set_module 8 from telemetry.story import story_set as story_set_module
9 9
10 test_harness_script = r""" 10 test_harness_script = r"""
11 function VerifyHardwareAccelerated(feature) { 11 function VerifyHardwareAccelerated(feature) {
12 feature += ': ' 12 feature += ': '
13 var list = document.querySelector('.feature-status-list'); 13 var list = document.querySelector('.feature-status-list');
14 for (var i=0; i < list.childElementCount; i++) { 14 for (var i=0; i < list.childElementCount; i++) {
15 var span_list = list.children[i].getElementsByTagName('span'); 15 var span_list = list.children[i].getElementsByTagName('span');
16 var feature_str = span_list[0].textContent; 16 var feature_str = span_list[0].textContent;
17 var value_str = span_list[1].textContent; 17 var value_str = span_list[1].textContent;
18 if ((feature_str == feature) && 18 if ((feature_str == feature) &&
19 (value_str == 'Hardware accelerated')) { 19 (value_str == 'Hardware accelerated')) {
20 return true; 20 return true;
21 } 21 }
22 } 22 }
23 return false; 23 return false;
24 }; 24 };
25 """; 25 """
26 26
27 class HardwareAcceleratedFeatureValidator(gpu_test_base.ValidatorBase): 27 class HardwareAcceleratedFeatureValidator(gpu_test_base.ValidatorBase):
28 def ValidateAndMeasurePage(self, page, tab, results): 28 def ValidateAndMeasurePage(self, page, tab, results):
29 feature = page.feature 29 feature = page.feature
30 if not tab.EvaluateJavaScript('VerifyHardwareAccelerated("%s")' % feature): 30 if not tab.EvaluateJavaScript('VerifyHardwareAccelerated("%s")' % feature):
31 print 'Test failed. Printing page contents:' 31 print 'Test failed. Printing page contents:'
32 print tab.EvaluateJavaScript('document.body.innerHTML') 32 print tab.EvaluateJavaScript('document.body.innerHTML')
33 raise page_test.Failure('%s not hardware accelerated' % feature) 33 raise page_test.Failure('%s not hardware accelerated' % feature)
34 34
35 def safe_feature_name(feature): 35 def safe_feature_name(feature):
(...skipping 11 matching lines...) Expand all
47 47
48 class HardwareAcceleratedFeature(gpu_test_base.TestBase): 48 class HardwareAcceleratedFeature(gpu_test_base.TestBase):
49 """Tests GPU acceleration is reported as active for various features""" 49 """Tests GPU acceleration is reported as active for various features"""
50 test = HardwareAcceleratedFeatureValidator 50 test = HardwareAcceleratedFeatureValidator
51 51
52 @classmethod 52 @classmethod
53 def Name(cls): 53 def Name(cls):
54 return 'hardware_accelerated_feature' 54 return 'hardware_accelerated_feature'
55 55
56 def _CreateExpectations(self): 56 def _CreateExpectations(self):
57 return expectations.HardwareAcceleratedFeatureExpectations() 57 return hw_expectations.HardwareAcceleratedFeatureExpectations()
58 58
59 def CreateStorySet(self, options): 59 def CreateStorySet(self, options):
60 features = ['WebGL', 'Canvas'] 60 features = ['WebGL', 'Canvas']
61 61
62 ps = story_set_module.StorySet() 62 ps = story_set_module.StorySet()
63 63
64 for feature in features: 64 for feature in features:
65 ps.AddStory(ChromeGpuPage(story_set=ps, feature=feature, 65 ps.AddStory(ChromeGpuPage(story_set=ps, feature=feature,
66 expectations=self.GetExpectations())) 66 expectations=self.GetExpectations()))
67 return ps 67 return ps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698