| OLD | NEW |
| 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 from gpu_tests import gpu_process_expectations as expectations | 4 from gpu_tests import gpu_process_expectations as expectations |
| 5 from gpu_tests import gpu_test_base | 5 from gpu_tests import gpu_test_base |
| 6 import page_sets | 6 import page_sets |
| 7 | 7 |
| 8 from telemetry.page import page_test | 8 from telemetry.page import page_test |
| 9 | 9 |
| 10 test_harness_script = r""" | 10 test_harness_script = r""" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 super(GpuProcessValidator, self).__init__( | 23 super(GpuProcessValidator, self).__init__( |
| 24 needs_browser_restart_after_each_page=True) | 24 needs_browser_restart_after_each_page=True) |
| 25 | 25 |
| 26 def CustomizeBrowserOptions(self, options): | 26 def CustomizeBrowserOptions(self, options): |
| 27 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') | 27 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') |
| 28 | 28 |
| 29 def ValidateAndMeasurePage(self, page, tab, results): | 29 def ValidateAndMeasurePage(self, page, tab, results): |
| 30 if hasattr(page, 'Validate'): | 30 if hasattr(page, 'Validate'): |
| 31 page.Validate(tab, results) | 31 page.Validate(tab, results) |
| 32 else: | 32 else: |
| 33 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()' | 33 has_gpu_channel_js = 'chrome.gpuBenchmarking.hasGpuChannel()' |
| 34 has_gpu_process = tab.EvaluateJavaScript(has_gpu_process_js) | 34 has_gpu_channel = tab.EvaluateJavaScript(has_gpu_channel_js) |
| 35 if not has_gpu_process: | 35 if not has_gpu_channel: |
| 36 raise page_test.Failure('No GPU process detected') | 36 raise page_test.Failure('No GPU channel detected') |
| 37 | 37 |
| 38 class GpuProcess(gpu_test_base.TestBase): | 38 class GpuProcess(gpu_test_base.TestBase): |
| 39 """Tests that accelerated content triggers the creation of a GPU process""" | 39 """Tests that accelerated content triggers the creation of a GPU process""" |
| 40 test = GpuProcessValidator | 40 test = GpuProcessValidator |
| 41 | 41 |
| 42 @classmethod | 42 @classmethod |
| 43 def Name(cls): | 43 def Name(cls): |
| 44 return 'gpu_process' | 44 return 'gpu_process' |
| 45 | 45 |
| 46 def _CreateExpectations(self): | 46 def _CreateExpectations(self): |
| 47 return expectations.GpuProcessExpectations() | 47 return expectations.GpuProcessExpectations() |
| 48 | 48 |
| 49 def CreateStorySet(self, options): | 49 def CreateStorySet(self, options): |
| 50 story_set = page_sets.GpuProcessTestsStorySet(self.GetExpectations()) | 50 story_set = page_sets.GpuProcessTestsStorySet(self.GetExpectations()) |
| 51 for page in story_set: | 51 for page in story_set: |
| 52 page.script_to_evaluate_on_commit = test_harness_script | 52 page.script_to_evaluate_on_commit = test_harness_script |
| 53 return story_set | 53 return story_set |
| OLD | NEW |