| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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-1.html', ['win', 'd3d9'], bug=345) | 66 self.Fail('test6-1.html', ['win', 'd3d9'], bug=345) |
| 67 self.Fail('test6-2.html', ['opengl'], bug=345) | 67 self.Fail('test6-2.html', ['opengl'], bug=345) |
| 68 self.Fail('test6-3.html', ['no_angle'], bug=345) | 68 self.Fail('test6-3.html', ['no_angle'], bug=345) |
| 69 # Test flaky expectations. | 69 # Test flaky expectations. |
| 70 self.Flaky('test7.html', bug=123, max_num_retries=5) | 70 self.Flaky('test7.html', bug=123, max_num_retries=5) |
| 71 self.Flaky('test8.html', ['win'], bug=123, max_num_retries=6) | 71 self.Flaky('test8.html', ['win'], bug=123, max_num_retries=6) |
| 72 self.Flaky('wildcardtest*.html', ['win'], bug=123, max_num_retries=7) | 72 self.Flaky('wildcardtest*.html', ['win'], bug=123, max_num_retries=7) |
| 73 | 73 |
| 74 class InvalidDeviceIDExpectation(gpu_test_expectations.GpuTestExpectations): |
| 75 def SetExpectations(self): |
| 76 self.Fail('test1.html', [('amd', '0x6613')], bug=123) |
| 77 |
| 74 class GpuTestExpectationsTest(unittest.TestCase): | 78 class GpuTestExpectationsTest(unittest.TestCase): |
| 75 def setUp(self): | 79 def setUp(self): |
| 76 self.expectations = SampleTestExpectations() | 80 self.expectations = SampleTestExpectations() |
| 77 | 81 |
| 78 def assertExpectationEquals(self, expected, page, platform=StubPlatform(''), | 82 def assertExpectationEquals(self, expected, page, platform=StubPlatform(''), |
| 79 gpu=0, device=0, vendor_string='', | 83 gpu=0, device=0, vendor_string='', |
| 80 device_string='', browser_type=None, | 84 device_string='', browser_type=None, |
| 81 gl_renderer=None): | 85 gl_renderer=None): |
| 82 self.expectations.ClearExpectationsCacheForTesting() | 86 self.expectations.ClearExpectationsCacheForTesting() |
| 83 result = self.expectations.GetExpectationForPage(StubBrowser( | 87 result = self.expectations.GetExpectationForPage(StubBrowser( |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 page1 = page_module.Page('http://test.com/test8.html', ps) | 195 page1 = page_module.Page('http://test.com/test8.html', ps) |
| 192 self.assertExpectationEquals('flaky', page1, StubPlatform('win')) | 196 self.assertExpectationEquals('flaky', page1, StubPlatform('win')) |
| 193 self.assertEquals(6, self.getRetriesForPage(page1, StubPlatform('win'))) | 197 self.assertEquals(6, self.getRetriesForPage(page1, StubPlatform('win'))) |
| 194 self.assertExpectationEquals('pass', page1, StubPlatform('mac')) | 198 self.assertExpectationEquals('pass', page1, StubPlatform('mac')) |
| 195 self.assertEquals(0, self.getRetriesForPage(page1, StubPlatform('mac'))) | 199 self.assertEquals(0, self.getRetriesForPage(page1, StubPlatform('mac'))) |
| 196 page2 = page_module.Page('http://test.com/wildcardtest1.html', ps) | 200 page2 = page_module.Page('http://test.com/wildcardtest1.html', ps) |
| 197 self.assertExpectationEquals('flaky', page2, StubPlatform('win')) | 201 self.assertExpectationEquals('flaky', page2, StubPlatform('win')) |
| 198 self.assertEquals(7, self.getRetriesForPage(page2, StubPlatform('win'))) | 202 self.assertEquals(7, self.getRetriesForPage(page2, StubPlatform('win'))) |
| 199 self.assertExpectationEquals('pass', page2, StubPlatform('mac')) | 203 self.assertExpectationEquals('pass', page2, StubPlatform('mac')) |
| 200 self.assertEquals(0, self.getRetriesForPage(page2, StubPlatform('mac'))) | 204 self.assertEquals(0, self.getRetriesForPage(page2, StubPlatform('mac'))) |
| 205 |
| 206 # Test that device IDs are checked to be integers. |
| 207 def testDeviceIDIsInteger(self): |
| 208 with self.assertRaises(ValueError): |
| 209 InvalidDeviceIDExpectation() |
| OLD | NEW |