Chromium Code Reviews| Index: content/test/gpu/gpu_tests/driver_bug_workarounds.py |
| diff --git a/content/test/gpu/gpu_tests/driver_bug_workarounds.py b/content/test/gpu/gpu_tests/driver_bug_workarounds.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..759092971a73b670b29e72ec4319f7930da13679 |
| --- /dev/null |
| +++ b/content/test/gpu/gpu_tests/driver_bug_workarounds.py |
| @@ -0,0 +1,62 @@ |
| +# Copyright 2015 The Chromium Authors. All rights reserved. |
|
Ken Russell (switch to Gerrit)
2015/11/21 01:06:30
Does this new test fail, as it should, when the fi
|
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| +from gpu_tests import gpu_test_base |
| +import gpu_tests.driver_bug_workarounds_expectations as hw_expectations |
| + |
| +from telemetry.page import page_test |
| +from telemetry.story import story_set as story_set_module |
| + |
| +test_harness_script = r""" |
| + function VerifyDriverBugWorkarounds(workaround) { |
| + var list = document.querySelector('.workarounds-list'); |
| + for (var i=0; i < list.childElementCount; i++) { |
| + var workaround_str = list.children[i].textContent; |
| + if (workaround_str == workaround) { |
| + return true; |
| + } |
| + } |
| + return false; |
| + }; |
| +""" |
| + |
| +class DriverBugWorkaroundsValidator(gpu_test_base.ValidatorBase): |
| + def __init__(self): |
| + super(DriverBugWorkaroundsValidator, self).__init__() |
| + self.workaround = "use_fake_gpu_driver_workaround" |
| + |
| + def ValidateAndMeasurePage(self, page, tab, results): |
| + if not tab.EvaluateJavaScript('VerifyDriverBugWorkarounds("%s")' |
| + % self.workaround): |
| + print 'Test failed. Printing page contents:' |
| + print tab.EvaluateJavaScript('document.body.innerHTML') |
| + raise page_test.Failure('fake driver workaround not enabled') |
| + |
| + def CustomizeBrowserOptions(self, options): |
| + options.AppendExtraBrowserArgs(['--' + self.workaround]) |
| + |
| +class ChromeGpuPage(gpu_test_base.PageBase): |
| + def __init__(self, story_set, expectations): |
| + super(ChromeGpuPage, self).__init__( |
| + url='chrome://gpu', page_set=story_set, base_dir=story_set.base_dir, |
| + name=('DriverBugWorkarounds'), |
| + expectations=expectations) |
| + self.script_to_evaluate_on_commit = test_harness_script |
| + |
| +class DriverBugWorkarounds(gpu_test_base.TestBase): |
| + """Test fake driver workaround is enabled""" |
| + test = DriverBugWorkaroundsValidator |
| + |
| + @classmethod |
| + def Name(cls): |
| + return 'driver_bug_workarounds' |
| + |
| + def _CreateExpectations(self): |
| + return hw_expectations.DriverBugWorkaroundsExpectations() |
| + |
| + def CreateStorySet(self, options): |
| + ps = story_set_module.StorySet() |
| + ps.AddStory(ChromeGpuPage(story_set=ps, |
| + expectations=self.GetExpectations())) |
| + |
| + return ps |