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

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

Issue 2297673002: Port WebGL extension availability tests to the integration test harness. (Closed)
Patch Set: WEBGL_compressed_texture_es3_0 is not available on desktop Linux. Created 4 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 4
5 import fnmatch 5 import fnmatch
6 import urlparse 6 import urlparse
7 7
8 # Valid expectation conditions are: 8 # Valid expectation conditions are:
9 # 9 #
10 # Operating systems: 10 # Operating systems:
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 self.os_conditions.append(cl) 82 self.os_conditions.append(cl)
83 elif cl in BROWSER_TYPE_CONDITIONS: 83 elif cl in BROWSER_TYPE_CONDITIONS:
84 self.browser_conditions.append(condition) 84 self.browser_conditions.append(condition)
85 else: 85 else:
86 raise ValueError('Unknown expectation condition: "%s"' % cl) 86 raise ValueError('Unknown expectation condition: "%s"' % cl)
87 87
88 88
89 class TestExpectations(object): 89 class TestExpectations(object):
90 """A class which defines the expectations for a page set test execution""" 90 """A class which defines the expectations for a page set test execution"""
91 91
92 def __init__(self): 92 def __init__(self, url_prefixes=None):
93 self._expectations = [] 93 self._expectations = []
94 self._url_prefixes = []
94 self._skip_matching_names = False 95 self._skip_matching_names = False
95 self._built_expectation_cache = True 96 self._built_expectation_cache = True
96 self._ClearExpectationsCache() 97 self._ClearExpectationsCache()
97 self.SetExpectations() 98 self.SetExpectations()
99 if url_prefixes:
100 for p in url_prefixes:
101 self._url_prefixes.append(p)
98 102
99 def SetExpectations(self): 103 def SetExpectations(self):
100 """Called on creation. Override to set up custom expectations.""" 104 """Called on creation. Override to set up custom expectations."""
101 pass 105 pass
102 106
103 def Fail(self, pattern, conditions=None, bug=None): 107 def Fail(self, pattern, conditions=None, bug=None):
104 self._Expect('fail', pattern, conditions, bug) 108 self._Expect('fail', pattern, conditions, bug)
105 109
106 def Skip(self, pattern, conditions=None, bug=None): 110 def Skip(self, pattern, conditions=None, bug=None):
107 self._Expect('skip', pattern, conditions, bug) 111 self._Expect('skip', pattern, conditions, bug)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 url_path = components[2] 174 url_path = components[2]
171 # Chop any leading slash since the expectations used by this class 175 # Chop any leading slash since the expectations used by this class
172 # assume that. 176 # assume that.
173 if url_path and url_path[0] == '/': 177 if url_path and url_path[0] == '/':
174 url_path = url_path[1:] 178 url_path = url_path[1:]
175 # Python's urlsplit doesn't seem to handle query arguments for 179 # Python's urlsplit doesn't seem to handle query arguments for
176 # file:// URLs properly. Split them off manually. 180 # file:// URLs properly. Split them off manually.
177 query_index = url_path.find('?') 181 query_index = url_path.find('?')
178 if query_index > 0: 182 if query_index > 0:
179 url_path = url_path[0:query_index] 183 url_path = url_path[0:query_index]
184 # Look for the URL prefixes specified at construction time, and
185 # trim the first one found, if any.
186 if self._url_prefixes:
187 for p in self._url_prefixes:
188 if url_path.startswith(p):
189 url_path = url_path[len(p):]
190 break
180 return url_path 191 return url_path
181 192
182 def _GetExpectationObjectForPage(self, browser, page): 193 def _GetExpectationObjectForPage(self, browser, page):
183 if not self._built_expectation_cache: 194 if not self._built_expectation_cache:
184 self._BuildExpectationsCache(browser, page) 195 self._BuildExpectationsCache(browser, page)
185 # First attempt to look up by the page's URL or name. 196 # First attempt to look up by the page's URL or name.
186 e = None 197 e = None
187 # Relative URL (common case). 198 # Relative URL (common case).
188 url = self._GetNormalizedURL(page.url, browser) 199 url = self._GetNormalizedURL(page.url, browser)
189 url_path = self._GetURLPath(url) 200 url_path = self._GetURLPath(url)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 platform = browser.platform 266 platform = browser.platform
256 os_matches = (not expectation.os_conditions or 267 os_matches = (not expectation.os_conditions or
257 platform.GetOSName() in expectation.os_conditions or 268 platform.GetOSName() in expectation.os_conditions or
258 platform.GetOSVersionName() in expectation.os_conditions) 269 platform.GetOSVersionName() in expectation.os_conditions)
259 270
260 browser_matches = ( 271 browser_matches = (
261 (not expectation.browser_conditions) or 272 (not expectation.browser_conditions) or
262 browser.browser_type in expectation.browser_conditions) 273 browser.browser_type in expectation.browser_conditions)
263 274
264 return os_matches and browser_matches 275 return os_matches and browser_matches
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/gpu_test_expectations.py ('k') | content/test/gpu/gpu_tests/webgl2_conformance_expectations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698