blob: fc603e00f7bb1558ae73eb0be2e8c94530235350 [file] [log] [blame]
# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
This is a client side WebGL clear test that measures how many frames-per-second
(FPS) can be achieved (possibly limited by vsync) with glClear only. It can be
useful to gauge that most WebGL applications won't likely achieve anything
higher than the FPS output of this test, assuming all else equal. It may also
be useful to various types of graphics developers as a sanity check. However,
your mileage may vary and we make no claims with respect to any particular
platform or application.
This test is expected to run 30 seconds by default. Any run that reports a FPS
value and finishes is a PASS. An acceptable FPS value is subjective and
platform, driver and/or project dependent... interpretation of the FPS results
are left up to the interested parties.
import logging
import os
import time
from autotest_lib.client.bin import test
from autotest_lib.client.common_lib import error
from autotest_lib.client.common_lib.cros import chrome
from import graphics_utils
class graphics_WebGLClear(graphics_utils.GraphicsTest):
"""WebGL clear graphics test."""
version = 1
perf_keyval = {}
test_duration_secs = 30
def setup(self):
def initialize(self):
super(graphics_WebGLClear, self).initialize()
self.perf_keyval = {}
def cleanup(self):
super(graphics_WebGLClear, self).cleanup()
def run_clear_test(self, browser, test_url):
"""Runs the clear test from the given url.
@param browser: The Browser object to run the test with.
@param test_url: The URL to the clear test suite.
tab = browser.tabs.New()
avg_fps = tab.EvaluateJavaScript('g_fpsTimer.averageFPS;')
self.perf_keyval['avg_fps'] = avg_fps
higher_is_better=True)'Average FPS = %f', avg_fps)
def run_once(self, test_duration_secs=30):
"""Finds a brower with telemetry, and run the test.
@param test_duration_secs: The test duration in seconds to run the test
self.test_duration_secs = test_duration_secs
# For this to have any noticable effect, SwapbuffersWait needs to be false
# in xorg.conf.
browser_args = '--disable-gpu-vsync'
with chrome.Chrome(logged_in=False,
init_network_controller=True) as cr:
clearsrc = os.path.join(self.autodir, 'deps', 'webgl_clear', 'src')
if not cr.browser.platform.SetHTTPServerDirectories(clearsrc):
raise error.TestFail('Failed: Unable to start HTTP server')
test_url = cr.browser.platform.http_server.UrlOf(
os.path.join(clearsrc, 'WebGLClear.html'))
self.run_clear_test(cr.browser, test_url)