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

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

Issue 2619493004: Port hw_accel_feature and screenshot_sync tests to new harness. (Closed)
Patch Set: Increase screenshot_sync repetitions back to 20. Created 3 years, 11 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
(Empty)
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
3 # found in the LICENSE file.
4 from gpu_tests import gpu_test_base
5 import gpu_tests.hardware_accelerated_feature_expectations as hw_expectations
6
7 from telemetry.page import legacy_page_test
8 from telemetry.story import story_set as story_set_module
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 HardwareAcceleratedFeatureValidator(gpu_test_base.ValidatorBase):
28 def ValidateAndMeasurePage(self, page, tab, results):
29 feature = page.feature
30 if not tab.EvaluateJavaScript('VerifyHardwareAccelerated("%s")' % feature):
31 print 'Test failed. Printing page contents:'
32 print tab.EvaluateJavaScript('document.body.innerHTML')
33 raise legacy_page_test.Failure('%s not hardware accelerated' % feature)
34
35 def safe_feature_name(feature):
36 return feature.lower().replace(' ', '_')
37
38 class ChromeGpuPage(gpu_test_base.PageBase):
39 def __init__(self, story_set, feature, expectations):
40 super(ChromeGpuPage, self).__init__(
41 url='chrome://gpu', page_set=story_set, base_dir=story_set.base_dir,
42 name=('HardwareAcceleratedFeature.%s_accelerated' %
43 safe_feature_name(feature)),
44 expectations=expectations)
45 self.feature = feature
46 self.script_to_evaluate_on_commit = test_harness_script
47
48 class HardwareAcceleratedFeature(gpu_test_base.TestBase):
49 """Tests GPU acceleration is reported as active for various features"""
50 test = HardwareAcceleratedFeatureValidator
51
52 @classmethod
53 def Name(cls):
54 return 'hardware_accelerated_feature'
55
56 def _CreateExpectations(self):
57 return hw_expectations.HardwareAcceleratedFeatureExpectations()
58
59 def CreateStorySet(self, options):
60 features = ['WebGL', 'Canvas']
61
62 ps = story_set_module.StorySet()
63
64 for feature in features:
65 ps.AddStory(ChromeGpuPage(story_set=ps, feature=feature,
66 expectations=self.GetExpectations()))
67 return ps
OLDNEW
« no previous file with comments | « content/test/gpu/generate_buildbot_json.py ('k') | 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