From b469bb60e8e51b3e2f90376c65e6a359862a3b02 Mon Sep 17 00:00:00 2001 From: "bajones@chromium.org" Date: Wed, 30 Oct 2013 17:50:40 +0000 Subject: [PATCH] Added test that check for the presence of the GPU process after running accelerated content BUG=312395 R=kbr@chromium.org Review URL: https://codereview.chromium.org/48113020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231870 0039d316-1c4b-4281-b951-d872f2087c98 --- content/test/gpu/gpu_tests/gpu_process.py | 30 +++++++++++++++++ .../test/gpu/gpu_tests/gpu_process_expectations.py | 26 +++++++++++++++ content/test/gpu/page_sets/gpu_process_tests.json | 38 ++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 content/test/gpu/gpu_tests/gpu_process.py create mode 100644 content/test/gpu/gpu_tests/gpu_process_expectations.py create mode 100644 content/test/gpu/page_sets/gpu_process_tests.json diff --git a/content/test/gpu/gpu_tests/gpu_process.py b/content/test/gpu/gpu_tests/gpu_process.py new file mode 100644 index 000000000000..edf7afd80ad9 --- /dev/null +++ b/content/test/gpu/gpu_tests/gpu_process.py @@ -0,0 +1,30 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +import gpu_process_expectations as expectations + +from telemetry import test +from telemetry.page import page_set +from telemetry.page import page_test + +class GpuProcessValidator(page_test.PageTest): + def __init__(self): + super(GpuProcessValidator, self).__init__('ValidatePage', + needs_browser_restart_after_each_run=True) + + def CustomizeBrowserOptions(self, options): + options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') + + def ValidatePage(self, page, tab, results): + has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()' + has_gpu_process = tab.EvaluateJavaScript(has_gpu_process_js) + if not has_gpu_process: + raise page_test.Failure('No GPU process detected') + +class GpuProcess(test.Test): + """Tests that accelerated content triggers the creation of a GPU process""" + test = GpuProcessValidator + page_set = 'page_sets/gpu_process_tests.json' + + def CreateExpectations(self, page_set): + return expectations.GpuProcessExpectations() diff --git a/content/test/gpu/gpu_tests/gpu_process_expectations.py b/content/test/gpu/gpu_tests/gpu_process_expectations.py new file mode 100644 index 000000000000..e5a765c4fbc9 --- /dev/null +++ b/content/test/gpu/gpu_tests/gpu_process_expectations.py @@ -0,0 +1,26 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +from telemetry.page import test_expectations as expectations + +# Valid expectation conditions are: +# +# Operating systems: +# win, xp, vista, win7, mac, leopard, snowleopard, lion, mountainlion, +# linux, chromeos, android +# +# GPU vendors: +# amd, arm, broadcom, hisilicon, intel, imagination, nvidia, qualcomm, +# vivante +# +# Specific GPUs can be listed as a tuple with vendor name and device ID. +# Examples: ('nvidia', 0x1234), ('arm', 'Mali-T604') +# Device IDs must be paired with a GPU vendor. + +class GpuProcessExpectations(expectations.TestExpectations): + def SetExpectations(self): + # Accelerated 2D canvas is not available on Linux due to driver instability + self.Fail('GpuProcess.canvas2d', ['linux'], bug=254724) + + self.Fail('GpuProcess.video', ['linux'], bug=257109) diff --git a/content/test/gpu/page_sets/gpu_process_tests.json b/content/test/gpu/page_sets/gpu_process_tests.json new file mode 100644 index 000000000000..63123107aec7 --- /dev/null +++ b/content/test/gpu/page_sets/gpu_process_tests.json @@ -0,0 +1,38 @@ +{ + "description": "Tests that accelerated content triggers the creation of a GPU process", + "user_agent_type": "desktop", + "pages": [ + { + "name": "GpuProcess.canvas2d", + "url": "file://../../data/gpu/functional_canvas_demo.html", + "navigate_steps": [ + { "action": "navigate"} + ] + }, + { + "name": "GpuProcess.css3d", + "url": "file://../../data/gpu/functional_3d_css.html", + "navigate_steps": [ + { "action": "navigate"} + ] + }, + { + "name": "GpuProcess.webgl", + "url": "file://../../data/gpu/functional_webgl.html", + "navigate_steps": [ + { "action": "navigate"} + ] + }, + { + "name": "GpuProcess.video", + "url": "file://../../data/gpu/functional_video.html", + "navigate_steps": [ + { "action": "navigate"}, + { + "action": "play", + "selector": "#video" + } + ] + } + ] +} -- 2.11.4.GIT