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

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

Issue 2378543002: (Reland) Port WebGL extension availability tests to the integration test harness. (Closed)
Patch Set: Skip WebglExtension_WEBGL_compressed_texture_s3tc_srgb on Android too. 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 import unittest 4 import unittest
5 5
6 from gpu_tests import gpu_integration_test
6 from gpu_tests import test_expectations 7 from gpu_tests import test_expectations
7 8
8 from telemetry.page import page as page_module 9 from telemetry.page import page as page_module
9 from telemetry.story import story_set 10 from telemetry.story import story_set
10 11
11 class StubPlatform(object): 12 class StubPlatform(object):
12 def __init__(self, os_name, os_version_name=None): 13 def __init__(self, os_name, os_version_name=None):
13 self.os_name = os_name 14 self.os_name = os_name
14 self.os_version_name = os_version_name 15 self.os_version_name = os_version_name
15 16
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 def CreateExpectation(self, expectation, url_pattern, conditions=None, 51 def CreateExpectation(self, expectation, url_pattern, conditions=None,
51 bug=None): 52 bug=None):
52 return SampleExpectationSubclass(expectation, url_pattern, 53 return SampleExpectationSubclass(expectation, url_pattern,
53 conditions=conditions, bug=bug) 54 conditions=conditions, bug=bug)
54 55
55 def SetExpectations(self): 56 def SetExpectations(self):
56 self.Fail('page1.html', ['win', 'mac'], bug=123) 57 self.Fail('page1.html', ['win', 'mac'], bug=123)
57 self.Fail('page2.html', ['vista'], bug=123) 58 self.Fail('page2.html', ['vista'], bug=123)
58 self.Fail('page3.html', bug=123) 59 self.Fail('page3.html', bug=123)
59 self.Fail('page4.*', bug=123) 60 self.Fail('page4.*', bug=123)
60 self.Fail('http://test.com/page5.html', bug=123)
61 self.Fail('Pages.page_6') 61 self.Fail('Pages.page_6')
62 self.Fail('page7.html', ['mountainlion']) 62 self.Fail('page7.html', ['mountainlion'])
63 self.Fail('page8.html', ['mavericks']) 63 self.Fail('page8.html', ['mavericks'])
64 self.Fail('page9.html', ['yosemite']) 64 self.Fail('page9.html', ['yosemite'])
65 # Test browser conditions. 65 # Test browser conditions.
66 self.Fail('page10.html', ['android', 'android-webview-shell'], bug=456) 66 self.Fail('page10.html', ['android', 'android-webview-shell'], bug=456)
67 # Test user defined conditions. 67 # Test user defined conditions.
68 self.Fail('page11.html', ['win', 'valid_condition_matched']) 68 self.Fail('page11.html', ['win', 'valid_condition_matched'])
69 self.Fail('page12.html', ['win', 'valid_condition_unmatched']) 69 self.Fail('page12.html', ['win', 'valid_condition_unmatched'])
70 # Test file:// scheme. 70 # Test file:// scheme.
71 self.Fail('conformance/attribs/page13.html') 71 self.Fail('conformance/attribs/page13.html')
72 # Test file:// scheme on Windows. 72 # Test file:// scheme on Windows.
73 self.Fail('conformance/attribs/page14.html', ['win']) 73 self.Fail('conformance/attribs/page14.html', ['win'])
74 # Explicitly matched paths have precedence over wildcards. 74 # Explicitly matched paths have precedence over wildcards.
75 self.Fail('conformance/glsl/*') 75 self.Fail('conformance/glsl/*')
76 self.Skip('conformance/glsl/page15.html') 76 self.Skip('conformance/glsl/page15.html')
77 77
78 def ExpectationAppliesToPage(self, expectation, browser, page): 78 def ExpectationAppliesToPage(self, expectation, browser, page):
79 if not super(SampleTestExpectations, 79 if not super(SampleTestExpectations,
80 self).ExpectationAppliesToPage(expectation, browser, page): 80 self).ExpectationAppliesToPage(expectation, browser, page):
81 return False 81 return False
82 # These tests can probably be expressed more tersely, but that 82 # These tests can probably be expressed more tersely, but that
83 # would reduce readability. 83 # would reduce readability.
84 if (not expectation.valid_condition_matched and 84 if (not expectation.valid_condition_matched and
85 not expectation.valid_condition_unmatched): 85 not expectation.valid_condition_unmatched):
86 return True 86 return True
87 return expectation.valid_condition_matched 87 return expectation.valid_condition_matched
88 88
89 class FailingAbsoluteTestExpectations(test_expectations.TestExpectations):
90 def CreateExpectation(self, expectation, url_pattern, conditions=None,
91 bug=None):
92 return SampleExpectationSubclass(expectation, url_pattern,
93 conditions=conditions, bug=bug)
94
95 def SetExpectations(self):
96 self.Fail('http://test.com/page5.html', bug=123)
97
89 class TestExpectationsTest(unittest.TestCase): 98 class TestExpectationsTest(unittest.TestCase):
90 def setUp(self): 99 def setUp(self):
91 self.expectations = SampleTestExpectations() 100 self.expectations = SampleTestExpectations(url_prefixes=[
101 'third_party/webgl/src/sdk/tests/',
102 'content/test/data/gpu'])
92 103
93 def assertExpectationEquals(self, expected, page, platform=StubPlatform(''), 104 def assertExpectationEquals(self, expected, page, platform=StubPlatform(''),
94 browser_type=None): 105 browser_type=None):
95 self.expectations.ClearExpectationsCacheForTesting() 106 self.expectations.ClearExpectationsCacheForTesting()
96 result = self.expectations.GetExpectationForPage( 107 result = self.expectations.GetExpectationForPage(
97 StubBrowser(platform, browser_type=browser_type), page) 108 StubBrowser(platform, browser_type=browser_type), page)
98 self.assertEquals(expected, result) 109 self.assertEquals(expected, result)
99 110
100 # Pages with no expectations should always return 'pass' 111 # Pages with no expectations should always return 'pass'
101 def testNoExpectations(self): 112 def testNoExpectations(self):
(...skipping 28 matching lines...) Expand all
130 self.assertExpectationEquals('fail', page, StubPlatform('linux')) 141 self.assertExpectationEquals('fail', page, StubPlatform('linux'))
131 142
132 # Expectations with wildcard characters should return for matching patterns 143 # Expectations with wildcard characters should return for matching patterns
133 def testWildcardExpectations(self): 144 def testWildcardExpectations(self):
134 ps = story_set.StorySet() 145 ps = story_set.StorySet()
135 page = page_module.Page('http://test.com/page4.html', ps) 146 page = page_module.Page('http://test.com/page4.html', ps)
136 page_js = page_module.Page('http://test.com/page4.html', ps) 147 page_js = page_module.Page('http://test.com/page4.html', ps)
137 self.assertExpectationEquals('fail', page, StubPlatform('win')) 148 self.assertExpectationEquals('fail', page, StubPlatform('win'))
138 self.assertExpectationEquals('fail', page_js, StubPlatform('win')) 149 self.assertExpectationEquals('fail', page_js, StubPlatform('win'))
139 150
140 # Expectations with absolute paths should match the entire path 151 # Absolute URLs in expectations are no longer allowed.
141 def testAbsoluteExpectations(self): 152 def testAbsoluteExpectationsAreForbidden(self):
142 ps = story_set.StorySet() 153 with self.assertRaises(ValueError):
143 page = page_module.Page('http://test.com/page5.html', ps) 154 FailingAbsoluteTestExpectations()
144 page_org = page_module.Page('http://test.org/page5.html', ps)
145 page_https = page_module.Page('https://test.com/page5.html', ps)
146 self.assertExpectationEquals('fail', page, StubPlatform('win'))
147 self.assertExpectationEquals('pass', page_org, StubPlatform('win'))
148 self.assertExpectationEquals('pass', page_https, StubPlatform('win'))
149 155
150 # Expectations can be set against page names as well as urls 156 # Expectations can be set against page names as well as urls
151 def testPageNameExpectations(self): 157 def testPageNameExpectations(self):
152 ps = story_set.StorySet() 158 ps = story_set.StorySet()
153 page = page_module.Page('http://test.com/page6.html', ps, 159 page = page_module.Page('http://test.com/page6.html', ps,
154 name='Pages.page_6') 160 name='Pages.page_6')
155 self.assertExpectationEquals('fail', page) 161 self.assertExpectationEquals('fail', page)
156 162
157 # Verify version-specific Mac expectations. 163 # Verify version-specific Mac expectations.
158 def testMacVersionExpectations(self): 164 def testMacVersionExpectations(self):
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 page = page_module.Page('http://test.com/conformance/glsl/page00.html', ps) 224 page = page_module.Page('http://test.com/conformance/glsl/page00.html', ps)
219 self.assertExpectationEquals('fail', page) 225 self.assertExpectationEquals('fail', page)
220 page = page_module.Page('http://test.com/conformance/glsl/page15.html', ps) 226 page = page_module.Page('http://test.com/conformance/glsl/page15.html', ps)
221 self.assertExpectationEquals('skip', page) 227 self.assertExpectationEquals('skip', page)
222 228
223 def testQueryArgsAreStrippedFromFileURLs(self): 229 def testQueryArgsAreStrippedFromFileURLs(self):
224 ps = story_set.StorySet() 230 ps = story_set.StorySet()
225 page = page_module.Page( 231 page = page_module.Page(
226 'file://conformance/glsl/page15.html?webglVersion=2', ps) 232 'file://conformance/glsl/page15.html?webglVersion=2', ps)
227 self.assertExpectationEquals('skip', page) 233 self.assertExpectationEquals('skip', page)
234
235 def testURLPrefixesAreStripped(self):
236 # This test uses the "_EmulatedPage" class from the GPU integration tests
237 # because it's in that context where support for URL prefixes was added.
238 self.assertExpectationEquals(
239 'skip',
240 gpu_integration_test._EmulatedPage(
241 'third_party/webgl/src/sdk/tests/conformance/glsl/page15.html',
242 'Page15'))
243 self.assertExpectationEquals(
244 'fail',
245 gpu_integration_test._EmulatedPage(
246 'third_party/webgl/src/sdk/tests/conformance/glsl/foo.html',
247 'Foo'))
248 # Test exact and wildcard matches on Windows.
249 self.assertExpectationEquals(
250 'skip',
251 gpu_integration_test._EmulatedPage(
252 'third_party\\webgl\\src\\sdk\\tests\\conformance\\glsl\\page15.html',
253 'Page15'),
254 StubPlatform('win'))
255 self.assertExpectationEquals(
256 'fail',
257 gpu_integration_test._EmulatedPage(
258 'third_party\\webgl\\src\\sdk\\tests\\conformance\\glsl\\foo.html',
259 'Foo'),
260 StubPlatform('win'))
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/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