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

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

Issue 2719853003: [Telemetry refactor] Drop "2" from method calls to JS API (Closed)
Patch Set: Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 4
5 import logging 5 import logging
6 import os 6 import os
7 import sys 7 import sys
8 8
9 from gpu_tests import gpu_integration_test 9 from gpu_tests import gpu_integration_test
10 from gpu_tests import path_util 10 from gpu_tests import path_util
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 # This indirection allows these tests to trampoline through 200 # This indirection allows these tests to trampoline through
201 # _RunGpuTest. 201 # _RunGpuTest.
202 test_name = args[0] 202 test_name = args[0]
203 getattr(self, test_name)(test_path, *args[1:]) 203 getattr(self, test_name)(test_path, *args[1:])
204 204
205 def _NavigateTo(self, test_path, harness_script): 205 def _NavigateTo(self, test_path, harness_script):
206 url = self.UrlOfStaticFilePath(test_path) 206 url = self.UrlOfStaticFilePath(test_path)
207 self.tab.Navigate(url, script_to_evaluate_on_commit=harness_script) 207 self.tab.Navigate(url, script_to_evaluate_on_commit=harness_script)
208 208
209 def _CheckTestCompletion(self): 209 def _CheckTestCompletion(self):
210 self.tab.action_runner.WaitForJavaScriptCondition2( 210 self.tab.action_runner.WaitForJavaScriptCondition(
211 'webglTestHarness._finished', timeout=300) 211 'webglTestHarness._finished', timeout=300)
212 if not self._DidWebGLTestSucceed(self.tab): 212 if not self._DidWebGLTestSucceed(self.tab):
213 self.fail(self._WebGLTestMessages(self.tab)) 213 self.fail(self._WebGLTestMessages(self.tab))
214 214
215 def _RunConformanceTest(self, test_path, *args): 215 def _RunConformanceTest(self, test_path, *args):
216 self._NavigateTo(test_path, conformance_harness_script) 216 self._NavigateTo(test_path, conformance_harness_script)
217 self._CheckTestCompletion() 217 self._CheckTestCompletion()
218 218
219 219
220 def _GetExtensionHarnessScript(self): 220 def _GetExtensionHarnessScript(self):
221 return conformance_harness_script + extension_harness_additional_script 221 return conformance_harness_script + extension_harness_additional_script
222 222
223 def _RunExtensionCoverageTest(self, test_path, *args): 223 def _RunExtensionCoverageTest(self, test_path, *args):
224 self._NavigateTo(test_path, self._GetExtensionHarnessScript()) 224 self._NavigateTo(test_path, self._GetExtensionHarnessScript())
225 self.tab.action_runner.WaitForJavaScriptCondition2( 225 self.tab.action_runner.WaitForJavaScriptCondition(
226 'window._loaded', timeout=300) 226 'window._loaded', timeout=300)
227 extension_list = args[0] 227 extension_list = args[0]
228 webgl_version = args[1] 228 webgl_version = args[1]
229 context_type = "webgl2" if webgl_version == 2 else "webgl" 229 context_type = "webgl2" if webgl_version == 2 else "webgl"
230 extension_list_string = "[" 230 extension_list_string = "["
231 for extension in extension_list: 231 for extension in extension_list:
232 extension_list_string = extension_list_string + extension + ", " 232 extension_list_string = extension_list_string + extension + ", "
233 extension_list_string = extension_list_string + "]" 233 extension_list_string = extension_list_string + "]"
234 self.tab.action_runner.EvaluateJavaScript2( 234 self.tab.action_runner.EvaluateJavaScript(
235 'checkSupportedExtensions({{ extensions_string }}, {{context_type}})', 235 'checkSupportedExtensions({{ extensions_string }}, {{context_type}})',
236 extensions_string=extension_list_string, context_type=context_type) 236 extensions_string=extension_list_string, context_type=context_type)
237 self._CheckTestCompletion() 237 self._CheckTestCompletion()
238 238
239 def _RunExtensionTest(self, test_path, *args): 239 def _RunExtensionTest(self, test_path, *args):
240 self._NavigateTo(test_path, self._GetExtensionHarnessScript()) 240 self._NavigateTo(test_path, self._GetExtensionHarnessScript())
241 self.tab.action_runner.WaitForJavaScriptCondition2( 241 self.tab.action_runner.WaitForJavaScriptCondition(
242 'window._loaded', timeout=300) 242 'window._loaded', timeout=300)
243 extension = args[0] 243 extension = args[0]
244 webgl_version = args[1] 244 webgl_version = args[1]
245 context_type = "webgl2" if webgl_version == 2 else "webgl" 245 context_type = "webgl2" if webgl_version == 2 else "webgl"
246 self.tab.action_runner.EvaluateJavaScript2( 246 self.tab.action_runner.EvaluateJavaScript(
247 'checkExtension({{ extension }}, {{ context_type }})', 247 'checkExtension({{ extension }}, {{ context_type }})',
248 extension=extension, context_type=context_type) 248 extension=extension, context_type=context_type)
249 self._CheckTestCompletion() 249 self._CheckTestCompletion()
250 250
251 @classmethod 251 @classmethod
252 def CustomizeOptions(cls): 252 def CustomizeOptions(cls):
253 assert cls._webgl_version == 1 or cls._webgl_version == 2 253 assert cls._webgl_version == 1 or cls._webgl_version == 2
254 browser_options = cls._finder_options.browser_options 254 browser_options = cls._finder_options.browser_options
255 # --test-type=gpu is used only to suppress the "Google API Keys are missing" 255 # --test-type=gpu is used only to suppress the "Google API Keys are missing"
256 # infobar, which causes flakiness in tests. 256 # infobar, which causes flakiness in tests.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 # implicitly becomes the common base directory, i.e., the Chromium 322 # implicitly becomes the common base directory, i.e., the Chromium
323 # src dir, and all URLs have to be specified relative to that. 323 # src dir, and all URLs have to be specified relative to that.
324 cls.SetStaticServerDirs([ 324 cls.SetStaticServerDirs([
325 os.path.join(path_util.GetChromiumSrcDir(), conformance_relpath), 325 os.path.join(path_util.GetChromiumSrcDir(), conformance_relpath),
326 os.path.join(path_util.GetChromiumSrcDir(), extensions_relpath)]) 326 os.path.join(path_util.GetChromiumSrcDir(), extensions_relpath)])
327 327
328 # Helper functions. 328 # Helper functions.
329 329
330 @staticmethod 330 @staticmethod
331 def _DidWebGLTestSucceed(tab): 331 def _DidWebGLTestSucceed(tab):
332 return tab.EvaluateJavaScript2('webglTestHarness._allTestSucceeded') 332 return tab.EvaluateJavaScript('webglTestHarness._allTestSucceeded')
333 333
334 @staticmethod 334 @staticmethod
335 def _WebGLTestMessages(tab): 335 def _WebGLTestMessages(tab):
336 return tab.EvaluateJavaScript2('webglTestHarness._messages') 336 return tab.EvaluateJavaScript('webglTestHarness._messages')
337 337
338 @classmethod 338 @classmethod
339 def _ParseTests(cls, path, version, webgl2_only, folder_min_version): 339 def _ParseTests(cls, path, version, webgl2_only, folder_min_version):
340 test_paths = [] 340 test_paths = []
341 current_dir = os.path.dirname(path) 341 current_dir = os.path.dirname(path)
342 full_path = os.path.normpath(os.path.join(conformance_path, path)) 342 full_path = os.path.normpath(os.path.join(conformance_path, path))
343 webgl_version = int(version.split('.')[0]) 343 webgl_version = int(version.split('.')[0])
344 344
345 if not os.path.exists(full_path): 345 if not os.path.exists(full_path):
346 raise Exception('The WebGL conformance test path specified ' + 346 raise Exception('The WebGL conformance test path specified ' +
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 if webgl_version > 1: 396 if webgl_version > 1:
397 test += '?webglVersion=' + str(webgl_version) 397 test += '?webglVersion=' + str(webgl_version)
398 test_paths.append(test) 398 test_paths.append(test)
399 399
400 return test_paths 400 return test_paths
401 401
402 402
403 def load_tests(loader, tests, pattern): 403 def load_tests(loader, tests, pattern):
404 del loader, tests, pattern # Unused. 404 del loader, tests, pattern # Unused.
405 return gpu_integration_test.LoadAllTestsInModule(sys.modules[__name__]) 405 return gpu_integration_test.LoadAllTestsInModule(sys.modules[__name__])
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/trace_integration_test.py ('k') | tools/chrome_proxy/common/chrome_proxy_measurements.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698