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

Side by Side Diff: content/test/gpu/gpu_tests/webgl_conformance.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: 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 json
5 import optparse
6 import os 4 import os
7 import sys
8 5
9 import gpu_test_base 6 from gpu_tests import gpu_test_base
10 import path_util 7 from gpu_tests import path_util
11 import webgl_conformance_expectations 8 from gpu_tests import webgl_conformance_expectations
12 import webgl2_conformance_expectations 9 from gpu_tests import webgl2_conformance_expectations
13 10
14 from telemetry.internal.browser import browser_finder 11 from telemetry.internal.browser import browser_finder
15 from telemetry.page import page_test 12 from telemetry.page import page_test
16 from telemetry.page import shared_page_state
17 from telemetry.story.story_set import StorySet 13 from telemetry.story.story_set import StorySet
18 14
19 15
20 conformance_path = os.path.join( 16 conformance_path = os.path.join(
21 path_util.GetChromiumSrcDir(), 17 path_util.GetChromiumSrcDir(),
22 'third_party', 'webgl', 'src', 'sdk', 'tests') 18 'third_party', 'webgl', 'src', 'sdk', 'tests')
23 19
24 conformance_harness_script = r""" 20 conformance_harness_script = r"""
25 var testHarness = {}; 21 var testHarness = {};
26 testHarness._allTestSucceeded = true; 22 testHarness._allTestSucceeded = true;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 # infobar, which causes flakiness in tests. 82 # infobar, which causes flakiness in tests.
87 options.AppendExtraBrowserArgs([ 83 options.AppendExtraBrowserArgs([
88 '--disable-gesture-requirement-for-media-playback', 84 '--disable-gesture-requirement-for-media-playback',
89 '--disable-domain-blocking-for-3d-apis', 85 '--disable-domain-blocking-for-3d-apis',
90 '--disable-gpu-process-crash-limit', 86 '--disable-gpu-process-crash-limit',
91 '--js-flags=--expose-gc', 87 '--js-flags=--expose-gc',
92 '--test-type=gpu' 88 '--test-type=gpu'
93 ]) 89 ])
94 browser = browser_finder.FindBrowser(options.finder_options) 90 browser = browser_finder.FindBrowser(options.finder_options)
95 if (browser.target_os.startswith('android') and 91 if (browser.target_os.startswith('android') and
96 browser.browser_type == 'android-webview-shell'): 92 browser.browser_type == 'android-webview-shell'):
97 # TODO(kbr): this is overly broad. We'd like to do this only on 93 # TODO(kbr): this is overly broad. We'd like to do this only on
98 # Nexus 9. It'll go away shortly anyway. crbug.com/499928 94 # Nexus 9. It'll go away shortly anyway. crbug.com/499928
99 # 95 #
100 # The --ignore_egl_sync_failures is only there to work around 96 # The --ignore_egl_sync_failures is only there to work around
101 # some strange failure on the Nexus 9 bot, not reproducible on 97 # some strange failure on the Nexus 9 bot, not reproducible on
102 # local hardware. 98 # local hardware.
103 options.AppendExtraBrowserArgs([ 99 options.AppendExtraBrowserArgs([
104 '--disable-gl-extensions=GL_EXT_disjoint_timer_query', 100 '--disable-gl-extensions=GL_EXT_disjoint_timer_query',
105 '--ignore_egl_sync_failures' 101 '--ignore_egl_sync_failures',
106 ]) 102 ])
107 103
108 104
109 class Webgl2ConformanceValidator(WebglConformanceValidator): 105 class Webgl2ConformanceValidator(WebglConformanceValidator):
110 def __init__(self): 106 def __init__(self):
111 super(Webgl2ConformanceValidator, self).__init__() 107 super(Webgl2ConformanceValidator, self).__init__()
112 108
113 def CustomizeBrowserOptions(self, options): 109 def CustomizeBrowserOptions(self, options):
114 # --test-type=gpu is used only to suppress the "Google API Keys are missing" 110 # --test-type=gpu is used only to suppress the "Google API Keys are missing"
115 # infobar, which causes flakiness in tests. 111 # infobar, which causes flakiness in tests.
116 options.AppendExtraBrowserArgs([ 112 options.AppendExtraBrowserArgs([
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 176
181 ps = StorySet(serving_dirs=[''], base_dir=conformance_path) 177 ps = StorySet(serving_dirs=[''], base_dir=conformance_path)
182 178
183 expectations = self.GetExpectations() 179 expectations = self.GetExpectations()
184 for test in tests: 180 for test in tests:
185 ps.AddStory(WebglConformancePage(ps, test, expectations)) 181 ps.AddStory(WebglConformancePage(ps, test, expectations))
186 182
187 return ps 183 return ps
188 184
189 def _CreateExpectations(self): 185 def _CreateExpectations(self):
190 assert (self._webgl_version == 1 or self._webgl_version == 2) 186 assert self._webgl_version == 1 or self._webgl_version == 2
191 if self._webgl_version == 1: 187 if self._webgl_version == 1:
192 return webgl_conformance_expectations.WebGLConformanceExpectations( 188 return webgl_conformance_expectations.WebGLConformanceExpectations(
193 conformance_path) 189 conformance_path)
194 else: 190 else:
195 return webgl2_conformance_expectations.WebGL2ConformanceExpectations( 191 return webgl2_conformance_expectations.WebGL2ConformanceExpectations(
196 conformance_path) 192 conformance_path)
197 193
198 @staticmethod 194 @staticmethod
199 def _ParseTests(path, version, webgl2_only, folder_min_version): 195 def _ParseTests(path, version, webgl2_only, folder_min_version):
200 test_paths = [] 196 test_paths = []
(...skipping 26 matching lines...) Expand all
227 i += 1 223 i += 1
228 min_version = line_tokens[i] 224 min_version = line_tokens[i]
229 i += 1 225 i += 1
230 226
231 min_version_to_compare = min_version or folder_min_version 227 min_version_to_compare = min_version or folder_min_version
232 228
233 if (min_version_to_compare and 229 if (min_version_to_compare and
234 _CompareVersion(version, min_version_to_compare) < 0): 230 _CompareVersion(version, min_version_to_compare) < 0):
235 continue 231 continue
236 232
237 if (webgl2_only and (not ('.txt' in test_name)) and 233 if (webgl2_only and not '.txt' in test_name and
238 ((not min_version_to_compare) or 234 (not min_version_to_compare or
239 (not min_version_to_compare.startswith('2')))): 235 not min_version_to_compare.startswith('2'))):
240 continue 236 continue
241 237
242 if '.txt' in test_name: 238 if '.txt' in test_name:
243 include_path = os.path.join(current_dir, test_name) 239 include_path = os.path.join(current_dir, test_name)
244 # We only check min-version >= 2.0.0 for the top level list. 240 # We only check min-version >= 2.0.0 for the top level list.
245 test_paths += WebglConformance._ParseTests( 241 test_paths += WebglConformance._ParseTests(
246 include_path, version, webgl2_only, min_version_to_compare) 242 include_path, version, webgl2_only, min_version_to_compare)
247 else: 243 else:
248 test = os.path.join(current_dir, test_name) 244 test = os.path.join(current_dir, test_name)
249 if webgl_version > 1: 245 if webgl_version > 1:
250 test += '?webglVersion=' + str(webgl_version) 246 test += '?webglVersion=' + str(webgl_version)
251 test_paths.append(test) 247 test_paths.append(test)
252 248
253 return test_paths 249 return test_paths
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698