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

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

Issue 2369373003: Revert of Port WebGL extension availability tests to the integration test harness. (Closed)
Patch Set: 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, url_prefixes=None): 92 def __init__(self):
93 self._expectations = [] 93 self._expectations = []
94 self._url_prefixes = []
95 self._skip_matching_names = False 94 self._skip_matching_names = False
96 self._built_expectation_cache = True 95 self._built_expectation_cache = True
97 self._ClearExpectationsCache() 96 self._ClearExpectationsCache()
98 self.SetExpectations() 97 self.SetExpectations()
99 if url_prefixes:
100 for p in url_prefixes:
101 self._url_prefixes.append(p)
102 98
103 def SetExpectations(self): 99 def SetExpectations(self):
104 """Called on creation. Override to set up custom expectations.""" 100 """Called on creation. Override to set up custom expectations."""
105 pass 101 pass
106 102
107 def Fail(self, pattern, conditions=None, bug=None): 103 def Fail(self, pattern, conditions=None, bug=None):
108 self._Expect('fail', pattern, conditions, bug) 104 self._Expect('fail', pattern, conditions, bug)
109 105
110 def Skip(self, pattern, conditions=None, bug=None): 106 def Skip(self, pattern, conditions=None, bug=None):
111 self._Expect('skip', pattern, conditions, bug) 107 self._Expect('skip', pattern, conditions, bug)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 url_path = components[2] 170 url_path = components[2]
175 # Chop any leading slash since the expectations used by this class 171 # Chop any leading slash since the expectations used by this class
176 # assume that. 172 # assume that.
177 if url_path and url_path[0] == '/': 173 if url_path and url_path[0] == '/':
178 url_path = url_path[1:] 174 url_path = url_path[1:]
179 # Python's urlsplit doesn't seem to handle query arguments for 175 # Python's urlsplit doesn't seem to handle query arguments for
180 # file:// URLs properly. Split them off manually. 176 # file:// URLs properly. Split them off manually.
181 query_index = url_path.find('?') 177 query_index = url_path.find('?')
182 if query_index > 0: 178 if query_index > 0:
183 url_path = url_path[0:query_index] 179 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
191 return url_path 180 return url_path
192 181
193 def _GetExpectationObjectForPage(self, browser, page): 182 def _GetExpectationObjectForPage(self, browser, page):
194 if not self._built_expectation_cache: 183 if not self._built_expectation_cache:
195 self._BuildExpectationsCache(browser, page) 184 self._BuildExpectationsCache(browser, page)
196 # First attempt to look up by the page's URL or name. 185 # First attempt to look up by the page's URL or name.
197 e = None 186 e = None
198 # Relative URL (common case). 187 # Relative URL (common case).
199 url = self._GetNormalizedURL(page.url, browser) 188 url = self._GetNormalizedURL(page.url, browser)
200 url_path = self._GetURLPath(url) 189 url_path = self._GetURLPath(url)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 platform = browser.platform 255 platform = browser.platform
267 os_matches = (not expectation.os_conditions or 256 os_matches = (not expectation.os_conditions or
268 platform.GetOSName() in expectation.os_conditions or 257 platform.GetOSName() in expectation.os_conditions or
269 platform.GetOSVersionName() in expectation.os_conditions) 258 platform.GetOSVersionName() in expectation.os_conditions)
270 259
271 browser_matches = ( 260 browser_matches = (
272 (not expectation.browser_conditions) or 261 (not expectation.browser_conditions) or
273 browser.browser_type in expectation.browser_conditions) 262 browser.browser_type in expectation.browser_conditions)
274 263
275 return os_matches and browser_matches 264 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