| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 telemetry.internal.platform import system_info | 6 from telemetry.internal.platform import system_info |
| 7 from telemetry.page import page as page_module | 7 from telemetry.page import page as page_module |
| 8 from telemetry.story import story_set | 8 from telemetry.story import story_set |
| 9 | 9 |
| 10 from gpu_tests import gpu_test_expectations | 10 from gpu_tests import gpu_test_expectations |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 class SampleTestExpectations(gpu_test_expectations.GpuTestExpectations): | 57 class SampleTestExpectations(gpu_test_expectations.GpuTestExpectations): |
| 58 def SetExpectations(self): | 58 def SetExpectations(self): |
| 59 # Test GPU conditions. | 59 # Test GPU conditions. |
| 60 self.Fail('test1.html', ['nvidia', 'intel'], bug=123) | 60 self.Fail('test1.html', ['nvidia', 'intel'], bug=123) |
| 61 self.Fail('test2.html', [('nvidia', 0x1001), ('nvidia', 0x1002)], bug=123) | 61 self.Fail('test2.html', [('nvidia', 0x1001), ('nvidia', 0x1002)], bug=123) |
| 62 self.Fail('test3.html', ['win', 'intel', ('amd', 0x1001)], bug=123) | 62 self.Fail('test3.html', ['win', 'intel', ('amd', 0x1001)], bug=123) |
| 63 self.Fail('test4.html', ['imagination']) | 63 self.Fail('test4.html', ['imagination']) |
| 64 self.Fail('test5.html', [('imagination', 'PowerVR SGX 554')]) | 64 self.Fail('test5.html', [('imagination', 'PowerVR SGX 554')]) |
| 65 # Test ANGLE conditions. | 65 # Test ANGLE conditions. |
| 66 self.Fail('test6.html', ['win', 'd3d9'], bug=345) | 66 self.Fail('test6-1.html', ['win', 'd3d9'], bug=345) |
| 67 self.Fail('test6-2.html', ['opengl'], bug=345) |
| 68 self.Fail('test6-3.html', ['no_angle'], bug=345) |
| 67 # Test flaky expectations. | 69 # Test flaky expectations. |
| 68 self.Flaky('test7.html', bug=123, max_num_retries=5) | 70 self.Flaky('test7.html', bug=123, max_num_retries=5) |
| 69 self.Flaky('test8.html', ['win'], bug=123, max_num_retries=6) | 71 self.Flaky('test8.html', ['win'], bug=123, max_num_retries=6) |
| 70 self.Flaky('wildcardtest*.html', ['win'], bug=123, max_num_retries=7) | 72 self.Flaky('wildcardtest*.html', ['win'], bug=123, max_num_retries=7) |
| 71 | 73 |
| 72 class GpuTestExpectationsTest(unittest.TestCase): | 74 class GpuTestExpectationsTest(unittest.TestCase): |
| 73 def setUp(self): | 75 def setUp(self): |
| 74 self.expectations = SampleTestExpectations() | 76 self.expectations = SampleTestExpectations() |
| 75 | 77 |
| 76 def assertExpectationEquals(self, expected, page, platform=StubPlatform(''), | 78 def assertExpectationEquals(self, expected, page, platform=StubPlatform(''), |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 self.assertExpectationEquals('pass', page, | 150 self.assertExpectationEquals('pass', page, |
| 149 vendor_string=VENDOR_STRING_IMAGINATION, | 151 vendor_string=VENDOR_STRING_IMAGINATION, |
| 150 device_string='Triangle Monster 3000') | 152 device_string='Triangle Monster 3000') |
| 151 self.assertExpectationEquals('pass', page, | 153 self.assertExpectationEquals('pass', page, |
| 152 vendor_string='Acme', | 154 vendor_string='Acme', |
| 153 device_string=DEVICE_STRING_SGX) | 155 device_string=DEVICE_STRING_SGX) |
| 154 | 156 |
| 155 # Test ANGLE conditions. | 157 # Test ANGLE conditions. |
| 156 def testANGLEConditions(self): | 158 def testANGLEConditions(self): |
| 157 ps = story_set.StorySet() | 159 ps = story_set.StorySet() |
| 158 page = page_module.Page('http://test.com/test6.html', ps) | 160 page = page_module.Page('http://test.com/test6-1.html', ps) |
| 159 self.assertExpectationEquals('pass', page, StubPlatform('win'), | 161 self.assertExpectationEquals('pass', page, StubPlatform('win'), |
| 160 gl_renderer='Direct3D11') | 162 gl_renderer='ANGLE Direct3D11') |
| 161 self.assertExpectationEquals('fail', page, StubPlatform('win'), | 163 self.assertExpectationEquals('fail', page, StubPlatform('win'), |
| 162 gl_renderer='Direct3D9') | 164 gl_renderer='ANGLE Direct3D9') |
| 165 |
| 166 # Regression test for a native mac GL_RENDERER string matching |
| 167 # an ANGLE expectation. |
| 168 page = page_module.Page('http://test.com/test6-2.html', ps) |
| 169 self.assertExpectationEquals('pass', page, StubPlatform('mac'), |
| 170 gl_renderer='Mac Something OpenGL') |
| 171 self.assertExpectationEquals('fail', page, StubPlatform('win'), |
| 172 gl_renderer='ANGLE OpenGL') |
| 173 |
| 174 # Tests for the no_angle keyword |
| 175 page = page_module.Page('http://test.com/test6-3.html', ps) |
| 176 self.assertExpectationEquals('fail', page, StubPlatform('mac'), |
| 177 gl_renderer='Mac Something OpenGL') |
| 178 self.assertExpectationEquals('pass', page, StubPlatform('win'), |
| 179 gl_renderer='ANGLE OpenGL') |
| 163 | 180 |
| 164 # Ensure retry mechanism is working. | 181 # Ensure retry mechanism is working. |
| 165 def testFlakyExpectation(self): | 182 def testFlakyExpectation(self): |
| 166 ps = story_set.StorySet() | 183 ps = story_set.StorySet() |
| 167 page = page_module.Page('http://test.com/test7.html', ps) | 184 page = page_module.Page('http://test.com/test7.html', ps) |
| 168 self.assertExpectationEquals('flaky', page) | 185 self.assertExpectationEquals('flaky', page) |
| 169 self.assertEquals(5, self.getRetriesForPage(page)) | 186 self.assertEquals(5, self.getRetriesForPage(page)) |
| 170 | 187 |
| 171 # Ensure the filtering from the TestExpectations superclass still works. | 188 # Ensure the filtering from the TestExpectations superclass still works. |
| 172 def testFlakyPerPlatformExpectation(self): | 189 def testFlakyPerPlatformExpectation(self): |
| 173 ps = story_set.StorySet() | 190 ps = story_set.StorySet() |
| 174 page1 = page_module.Page('http://test.com/test8.html', ps) | 191 page1 = page_module.Page('http://test.com/test8.html', ps) |
| 175 self.assertExpectationEquals('flaky', page1, StubPlatform('win')) | 192 self.assertExpectationEquals('flaky', page1, StubPlatform('win')) |
| 176 self.assertEquals(6, self.getRetriesForPage(page1, StubPlatform('win'))) | 193 self.assertEquals(6, self.getRetriesForPage(page1, StubPlatform('win'))) |
| 177 self.assertExpectationEquals('pass', page1, StubPlatform('mac')) | 194 self.assertExpectationEquals('pass', page1, StubPlatform('mac')) |
| 178 self.assertEquals(0, self.getRetriesForPage(page1, StubPlatform('mac'))) | 195 self.assertEquals(0, self.getRetriesForPage(page1, StubPlatform('mac'))) |
| 179 page2 = page_module.Page('http://test.com/wildcardtest1.html', ps) | 196 page2 = page_module.Page('http://test.com/wildcardtest1.html', ps) |
| 180 self.assertExpectationEquals('flaky', page2, StubPlatform('win')) | 197 self.assertExpectationEquals('flaky', page2, StubPlatform('win')) |
| 181 self.assertEquals(7, self.getRetriesForPage(page2, StubPlatform('win'))) | 198 self.assertEquals(7, self.getRetriesForPage(page2, StubPlatform('win'))) |
| 182 self.assertExpectationEquals('pass', page2, StubPlatform('mac')) | 199 self.assertExpectationEquals('pass', page2, StubPlatform('mac')) |
| 183 self.assertEquals(0, self.getRetriesForPage(page2, StubPlatform('mac'))) | 200 self.assertEquals(0, self.getRetriesForPage(page2, StubPlatform('mac'))) |
| OLD | NEW |