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

Side by Side Diff: content/test/gpu/gpu_tests/hardware_accelerated_feature_integration_test.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 2017 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
5 from gpu_tests import gpu_integration_test
6 import gpu_tests.hardware_accelerated_feature_expectations as hw_expectations
7
8 test_harness_script = r"""
9 function VerifyHardwareAccelerated(feature) {
10 feature += ': '
11 var list = document.querySelector('.feature-status-list');
12 for (var i=0; i < list.childElementCount; i++) {
13 var span_list = list.children[i].getElementsByTagName('span');
14 var feature_str = span_list[0].textContent;
15 var value_str = span_list[1].textContent;
16 if ((feature_str == feature) &&
17 (value_str == 'Hardware accelerated')) {
18 return true;
19 }
20 }
21 return false;
22 };
23 """
24
25 def safe_feature_name(feature):
26 return feature.lower().replace(' ', '_')
27
28 class HardwareAcceleratedFeatureIntegrationTest(
29 gpu_integration_test.GpuIntegrationTest):
30 """Tests GPU acceleration is reported as active for various features."""
31
32 @classmethod
33 def Name(cls):
34 """The name by which this test is invoked on the command line."""
35 return 'hardware_accelerated_feature'
36
37 @classmethod
38 def setUpClass(cls):
39 super(cls, HardwareAcceleratedFeatureIntegrationTest).setUpClass()
40 cls.SetBrowserOptions(cls._finder_options)
41 cls.StartBrowser()
42 cls.SetStaticServerDirs([])
43
44 @classmethod
45 def _CreateExpectations(cls):
46 return hw_expectations.HardwareAcceleratedFeatureExpectations()
47
48 def _Navigate(self, url):
49 # It's crucial to use the action_runner, rather than the tab's
50 # Navigate method directly. It waits for the document ready state
51 # to become interactive or better, avoiding critical race
52 # conditions.
53 self.tab.action_runner.Navigate(
54 url, script_to_evaluate_on_commit=test_harness_script)
55
56 @classmethod
57 def GenerateGpuTests(cls, options):
58 tests = ('WebGL', 'Canvas')
59 for feature in tests:
60 yield('HardwareAcceleratedFeature_%s_accelerated' %
61 safe_feature_name(feature),
62 'chrome://gpu',
63 (feature))
64
65 def RunActualGpuTest(self, test_path, *args):
66 feature = args[0]
67 self._Navigate(test_path)
68 tab = self.tab
69 if not tab.EvaluateJavaScript('VerifyHardwareAccelerated("%s")' % feature):
70 print 'Test failed. Printing page contents:'
71 print tab.EvaluateJavaScript('document.body.innerHTML')
72 self.fail('%s not hardware accelerated' % feature)
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/hardware_accelerated_feature_expectations.py ('k') | content/test/gpu/gpu_tests/screenshot_sync.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698