Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: content/test/gpu/gpu_tests/gpu_process.py

Issue 411143003: Add an "in_unit_test_mode" attribute to the environment. Use this to default output format to 'gtes… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comment. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 import gpu_process_expectations as expectations 4 import gpu_process_expectations as expectations
5 import page_sets 5 import page_sets
6 6
7 from telemetry import benchmark 7 from telemetry import benchmark
8 from telemetry.page import page_set 8 from telemetry.page import page_set
9 from telemetry.page import page_test 9 from telemetry.page import page_test
10 10
11 test_harness_script = r""" 11 test_harness_script = r"""
12 var domAutomationController = {}; 12 var domAutomationController = {};
13 domAutomationController._finished = false; 13 domAutomationController._finished = false;
14 domAutomationController.setAutomationId = function(id) {} 14 domAutomationController.setAutomationId = function(id) {}
15 domAutomationController.send = function(msg) { 15 domAutomationController.send = function(msg) {
16 domAutomationController._finished = true; 16 domAutomationController._finished = true;
17 } 17 }
18 18
19 window.domAutomationController = domAutomationController; 19 window.domAutomationController = domAutomationController;
20 """ 20 """
21 21
22 class _GpuProcessValidator(page_test.PageTest): 22 class _GpuProcessValidator(page_test.PageTest):
23 options = {'output_format': 'gtest'}
24
23 def __init__(self): 25 def __init__(self):
24 super(_GpuProcessValidator, self).__init__( 26 super(_GpuProcessValidator, self).__init__(
25 needs_browser_restart_after_each_page=True) 27 needs_browser_restart_after_each_page=True)
26 28
27 def CustomizeBrowserOptions(self, options): 29 def CustomizeBrowserOptions(self, options):
28 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') 30 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
29 31
30 def ValidatePage(self, page, tab, results): 32 def ValidatePage(self, page, tab, results):
31 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()' 33 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()'
32 has_gpu_process = tab.EvaluateJavaScript(has_gpu_process_js) 34 has_gpu_process = tab.EvaluateJavaScript(has_gpu_process_js)
33 if not has_gpu_process: 35 if not has_gpu_process:
34 raise page_test.Failure('No GPU process detected') 36 raise page_test.Failure('No GPU process detected')
35 37
36 class GpuProcess(benchmark.Benchmark): 38 class GpuProcess(benchmark.Benchmark):
37 """Tests that accelerated content triggers the creation of a GPU process""" 39 """Tests that accelerated content triggers the creation of a GPU process"""
38 test = _GpuProcessValidator 40 test = _GpuProcessValidator
39 page_set = page_sets.GpuProcessTestsPageSet 41 page_set = page_sets.GpuProcessTestsPageSet
40 42
41 def CreateExpectations(self, page_set): 43 def CreateExpectations(self, page_set):
42 return expectations.GpuProcessExpectations() 44 return expectations.GpuProcessExpectations()
43 45
44 def CreatePageSet(self, options): 46 def CreatePageSet(self, options):
45 page_set = super(GpuProcess, self).CreatePageSet(options) 47 page_set = super(GpuProcess, self).CreatePageSet(options)
46 for page in page_set.pages: 48 for page in page_set.pages:
47 page.script_to_evaluate_on_commit = test_harness_script 49 page.script_to_evaluate_on_commit = test_harness_script
48 return page_set 50 return page_set
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698