[Telemetry] Make the default Name of benchmark to be module_name.ClassName
[chromium-blink-merge.git] / content / test / gpu / gpu_tests / gpu_process.py
blob91d43c1f06ed691e7892bc21181c92c74dfe5b79
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 import gpu_process_expectations as expectations
5 import page_sets
7 from telemetry import benchmark
8 from telemetry.page import page_set
9 from telemetry.page import page_test
11 test_harness_script = r"""
12 var domAutomationController = {};
13 domAutomationController._finished = false;
14 domAutomationController.setAutomationId = function(id) {}
15 domAutomationController.send = function(msg) {
16 domAutomationController._finished = true;
19 window.domAutomationController = domAutomationController;
20 """
22 class _GpuProcessValidator(page_test.PageTest):
23 def __init__(self):
24 super(_GpuProcessValidator, self).__init__(
25 needs_browser_restart_after_each_page=True)
27 def CustomizeBrowserOptions(self, options):
28 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
30 def ValidateAndMeasurePage(self, page, tab, results):
31 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()'
32 has_gpu_process = tab.EvaluateJavaScript(has_gpu_process_js)
33 if not has_gpu_process:
34 raise page_test.Failure('No GPU process detected')
36 class GpuProcess(benchmark.Benchmark):
37 """Tests that accelerated content triggers the creation of a GPU process"""
38 test = _GpuProcessValidator
40 @classmethod
41 def Name(cls):
42 return 'gpu_process'
44 def CreateExpectations(self):
45 return expectations.GpuProcessExpectations()
47 def CreatePageSet(self, options):
48 page_set = page_sets.GpuProcessTestsPageSet()
49 for page in page_set.pages:
50 page.script_to_evaluate_on_commit = test_harness_script
51 return page_set