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 legacy_page_test |
9 | 9 |
10 test_harness_script = r""" | 10 test_harness_script = r""" |
11 var domAutomationController = {}; | 11 var domAutomationController = {}; |
12 domAutomationController._finished = false; | 12 domAutomationController._finished = false; |
13 domAutomationController.setAutomationId = function(id) {} | 13 domAutomationController.setAutomationId = function(id) {} |
14 domAutomationController.send = function(msg) { | 14 domAutomationController.send = function(msg) { |
15 domAutomationController._finished = true; | 15 domAutomationController._finished = true; |
16 } | 16 } |
17 | 17 |
18 window.domAutomationController = domAutomationController; | 18 window.domAutomationController = domAutomationController; |
(...skipping 15 matching lines...) Expand all Loading... |
34 def CustomizeBrowserOptions(self, options): | 34 def CustomizeBrowserOptions(self, options): |
35 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') | 35 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') |
36 | 36 |
37 def ValidateAndMeasurePage(self, page, tab, results): | 37 def ValidateAndMeasurePage(self, page, tab, results): |
38 if hasattr(page, 'Validate'): | 38 if hasattr(page, 'Validate'): |
39 page.Validate(tab, results) | 39 page.Validate(tab, results) |
40 else: | 40 else: |
41 has_gpu_channel_js = 'chrome.gpuBenchmarking.hasGpuChannel()' | 41 has_gpu_channel_js = 'chrome.gpuBenchmarking.hasGpuChannel()' |
42 has_gpu_channel = tab.EvaluateJavaScript(has_gpu_channel_js) | 42 has_gpu_channel = tab.EvaluateJavaScript(has_gpu_channel_js) |
43 if not has_gpu_channel: | 43 if not has_gpu_channel: |
44 raise page_test.Failure('No GPU channel detected') | 44 raise legacy_page_test.Failure('No GPU channel detected') |
45 | 45 |
46 class GpuProcess(gpu_test_base.TestBase): | 46 class GpuProcess(gpu_test_base.TestBase): |
47 """Tests that accelerated content triggers the creation of a GPU process""" | 47 """Tests that accelerated content triggers the creation of a GPU process""" |
48 test = GpuProcessValidator | 48 test = GpuProcessValidator |
49 | 49 |
50 @classmethod | 50 @classmethod |
51 def Name(cls): | 51 def Name(cls): |
52 return 'gpu_process' | 52 return 'gpu_process' |
53 | 53 |
54 def _CreateExpectations(self): | 54 def _CreateExpectations(self): |
55 return expectations.GpuProcessExpectations() | 55 return expectations.GpuProcessExpectations() |
56 | 56 |
57 def CreateStorySet(self, options): | 57 def CreateStorySet(self, options): |
58 browser_type = options.browser_options.browser_type | 58 browser_type = options.browser_options.browser_type |
59 is_platform_android = browser_type.startswith('android') | 59 is_platform_android = browser_type.startswith('android') |
60 story_set = page_sets.GpuProcessTestsStorySet(self.GetExpectations(), | 60 story_set = page_sets.GpuProcessTestsStorySet(self.GetExpectations(), |
61 is_platform_android) | 61 is_platform_android) |
62 for page in story_set: | 62 for page in story_set: |
63 page.script_to_evaluate_on_commit = test_harness_script | 63 page.script_to_evaluate_on_commit = test_harness_script |
64 return story_set | 64 return story_set |
OLD | NEW |