OLD | NEW |
| (Empty) |
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 | |
3 # found in the LICENSE file. | |
4 from gpu_tests import gpu_process_expectations as expectations | |
5 from gpu_tests import gpu_test_base | |
6 import page_sets | |
7 | |
8 from telemetry.page import legacy_page_test | |
9 | |
10 test_harness_script = r""" | |
11 var domAutomationController = {}; | |
12 domAutomationController._finished = false; | |
13 domAutomationController.setAutomationId = function(id) {} | |
14 domAutomationController.send = function(msg) { | |
15 domAutomationController._finished = true; | |
16 } | |
17 | |
18 window.domAutomationController = domAutomationController; | |
19 | |
20 function GetDriverBugWorkarounds() { | |
21 var query_result = document.querySelector('.workarounds-list'); | |
22 var browser_list = [] | |
23 for (var i=0; i < query_result.childElementCount; i++) | |
24 browser_list.push(query_result.children[i].textContent); | |
25 return browser_list; | |
26 }; | |
27 """ | |
28 | |
29 class GpuProcessValidator(gpu_test_base.ValidatorBase): | |
30 def __init__(self): | |
31 super(GpuProcessValidator, self).__init__( | |
32 needs_browser_restart_after_each_page=True) | |
33 | |
34 def CustomizeBrowserOptions(self, options): | |
35 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') | |
36 | |
37 def ValidateAndMeasurePage(self, page, tab, results): | |
38 if hasattr(page, 'Validate'): | |
39 page.Validate(tab, results) | |
40 else: | |
41 has_gpu_channel_js = 'chrome.gpuBenchmarking.hasGpuChannel()' | |
42 has_gpu_channel = tab.EvaluateJavaScript(has_gpu_channel_js) | |
43 if not has_gpu_channel: | |
44 raise legacy_page_test.Failure('No GPU channel detected') | |
45 | |
46 class GpuProcess(gpu_test_base.TestBase): | |
47 """Tests that accelerated content triggers the creation of a GPU process""" | |
48 test = GpuProcessValidator | |
49 | |
50 @classmethod | |
51 def Name(cls): | |
52 return 'gpu_process' | |
53 | |
54 def _CreateExpectations(self): | |
55 return expectations.GpuProcessExpectations() | |
56 | |
57 def CreateStorySet(self, options): | |
58 browser_type = options.browser_options.browser_type | |
59 is_platform_android = browser_type.startswith('android') | |
60 story_set = page_sets.GpuProcessTestsStorySet(self.GetExpectations(), | |
61 is_platform_android) | |
62 for page in story_set: | |
63 page.script_to_evaluate_on_commit = test_harness_script | |
64 return story_set | |
OLD | NEW |