Commit 5a730703 authored by Brian Sheedy's avatar Brian Sheedy Committed by Commit Bot

Standardize GPU browser argument logic

Refactors the GPU Telemetry code to do the following:
1. Move arguments that are used more than once to constants in a new
   file.
2. Standardize how browser arguments are determined. Now, tests only
   call either CustomizeBrowserArgs() or
   RestartBrowserIfNecessaryWithArgs() with any non-default args to use.
   The base class now handles application of child class-specific
   default arguments using the GenerateBrowserArgs() class method.
3. Move the --disable-metal-test-shaders argument to be applied to all
   GPU tests, not just WebGL ones.

Bug: 1085899, 1090480
Change-Id: I9f73d5953420cb5b5c8bd3f71d4b091751a92595
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2300801
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: default avatarYuly Novikov <ynovikov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789137}
parent 6cd43a16
# Copyright 2020 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.
"""String constants for commonly used browser arguments."""
AUTOPLAY_POLICY_NO_USER_GESTURE_REQUIRED =\
'--autoplay-policy=no-user-gesture-required'
DISABLE_ACCELERATED_2D_CANVAS = '--disable-accelerated-2d-canvas'
DISABLE_DEVICE_DISCOVERY_NOTIFICATIONS =\
'--disable-device-discovery-notifications'
DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS = '--disable-domain-blocking-for-3d-apis'
DISABLE_FEATURES_D3D11_VIDEO_DECODER = '--disable-features=D3D11VideoDecoder'
DISABLE_GPU = '--disable-gpu'
DISABLE_GPU_COMPOSITING = '--disable-gpu-compositing'
DISABLE_GPU_PROCESS_CRASH_LIMIT = '--disable-gpu-process-crash-limit'
DISABLE_SOFTWARE_COMPOSITING_FALLBACK =\
'--disable-software-compositing-fallback'
DISABLE_SOFTWARE_RASTERIZER = '--disable-software-rasterizer'
DISABLE_VP_SCALING = '--disable_vp_scaling=1'
ENABLE_EXPERIMENTAL_WEB_PLATFORM_FEATURES =\
'--enable-experimental-web-platform-features'
ENABLE_GPU_BENCHMARKING = '--enable-gpu-benchmarking'
ENSURE_FORCED_COLOR_PROFILE = '--ensure-forced-color-profile'
FORCE_COLOR_PROFILE_SRGB = '--force-color-profile=srgb'
FORCE_GPU_RASTERIZATION = '--force-gpu-rasterization'
TEST_TYPE_GPU = '--test-type=gpu'
......@@ -7,6 +7,7 @@ import os
import sys
import time
from gpu_tests import common_browser_args as cba
from gpu_tests import gpu_integration_test
from gpu_tests import path_util
......@@ -68,19 +69,25 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
action='store_true',
default=False)
@staticmethod
def _AddDefaultArgs(browser_args):
# These are options specified for every test.
return [
'--disable-gpu-process-crash-limit',
@classmethod
def GenerateBrowserArgs(cls, additional_args):
"""Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information.
"""
default_args = super(ContextLostIntegrationTest,
cls).GenerateBrowserArgs(additional_args)
default_args.extend([
cba.DISABLE_GPU_PROCESS_CRASH_LIMIT,
# Required to call crashGpuProcess.
'--enable-gpu-benchmarking',
cba.ENABLE_GPU_BENCHMARKING,
# Disable:
# Do you want the application "Chromium Helper.app" to accept incoming
# network connections?
# dialogs on macOS. crbug.com/969559
'--disable-device-discovery-notifications',
] + browser_args
cba.DISABLE_DEVICE_DISCOVERY_NOTIFICATIONS,
])
return default_args
@classmethod
def GenerateGpuTests(cls, options):
......@@ -130,8 +137,7 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
# Most of the tests need this, so add it to the default set of
# command line arguments used to launch the browser, to reduce the
# number of browser restarts between tests.
cls.CustomizeBrowserArgs(
cls._AddDefaultArgs(['--disable-domain-blocking-for-3d-apis']))
cls.CustomizeBrowserArgs([cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS])
cls.StartBrowser()
cls.SetStaticServerDirs([data_path])
......@@ -231,21 +237,21 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
def _GpuCrash_GPUProcessCrashesExactlyOncePerVisitToAboutGpuCrash(
self, test_path):
self.RestartBrowserIfNecessaryWithArgs(
self._AddDefaultArgs(['--disable-domain-blocking-for-3d-apis']))
[cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS])
self._NavigateAndWaitForLoad(test_path)
self._KillGPUProcess(2, True)
self._RestartBrowser('must restart after tests that kill the GPU process')
def _ContextLost_WebGLContextLostFromGPUProcessExit(self, test_path):
self.RestartBrowserIfNecessaryWithArgs(
self._AddDefaultArgs(['--disable-domain-blocking-for-3d-apis']))
[cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS])
self._NavigateAndWaitForLoad(test_path)
self._KillGPUProcess(1, False)
self._RestartBrowser('must restart after tests that kill the GPU process')
def _ContextLost_WebGLContextLostFromLoseContextExtension(self, test_path):
self.RestartBrowserIfNecessaryWithArgs(
self._AddDefaultArgs(['--disable-domain-blocking-for-3d-apis']))
[cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS])
url = self.UrlOfStaticFilePath(test_path)
tab = self.tab
tab.Navigate(url, script_to_evaluate_on_commit=harness_script)
......@@ -254,7 +260,7 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
def _ContextLost_WebGLContextLostFromQuantity(self, test_path):
self.RestartBrowserIfNecessaryWithArgs(
self._AddDefaultArgs(['--disable-domain-blocking-for-3d-apis']))
[cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS])
self._NavigateAndWaitForLoad(test_path)
# Try to coerce GC to clean up any contexts not attached to the page.
# This method seems unreliable, so the page will also attempt to
......@@ -264,13 +270,13 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
def _ContextLost_WebGLContextLostFromSelectElement(self, test_path):
self.RestartBrowserIfNecessaryWithArgs(
self._AddDefaultArgs(['--disable-domain-blocking-for-3d-apis']))
[cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS])
self._NavigateAndWaitForLoad(test_path)
self._WaitForTabAndCheckCompletion()
def _ContextLost_WebGLContextLostInHiddenTab(self, test_path):
self.RestartBrowserIfNecessaryWithArgs(
self._AddDefaultArgs(['--disable-domain-blocking-for-3d-apis']))
[cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS])
self._NavigateAndWaitForLoad(test_path)
# Test losing a context in a hidden tab. This test passes if the tab
# doesn't crash.
......@@ -281,7 +287,7 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
self._WaitForTabAndCheckCompletion()
def _ContextLost_WebGLBlockedAfterJSNavigation(self, test_path):
self.RestartBrowserIfNecessaryWithArgs(self._AddDefaultArgs([]))
self.RestartBrowserIfNecessaryWithArgs([])
self._NavigateAndWaitForLoad(test_path)
tab = self.tab
# Make sure the tab got a WebGL context.
......@@ -305,7 +311,7 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
self._RestartBrowser('must restart after tests that kill the GPU process')
def _ContextLost_WebGLUnblockedAfterUserInitiatedReload(self, test_path):
self.RestartBrowserIfNecessaryWithArgs(self._AddDefaultArgs([]))
self.RestartBrowserIfNecessaryWithArgs([])
self._NavigateAndWaitForLoad(test_path)
tab = self.tab
# Make sure the tab initially got a WebGL context.
......@@ -330,7 +336,7 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
self._RestartBrowser('must restart after tests that kill the GPU process')
def _GpuNormalTermination_OriginalWebGLNotBlocked(self, test_path):
self.RestartBrowserIfNecessaryWithArgs(self._AddDefaultArgs([]))
self.RestartBrowserIfNecessaryWithArgs([])
self._NavigateAndWaitForLoad(test_path)
tab = self.tab
......@@ -343,7 +349,7 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
self._RestartBrowser('must restart after tests that kill the GPU process')
def _GpuNormalTermination_NewWebGLNotBlocked(self, test_path):
self.RestartBrowserIfNecessaryWithArgs(self._AddDefaultArgs([]))
self.RestartBrowserIfNecessaryWithArgs([])
self._NavigateAndWaitForLoad(test_path)
tab = self.tab
......@@ -357,19 +363,18 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
def _ContextLost_WorkerRAFAfterGPUCrash(self, test_path):
self.RestartBrowserIfNecessaryWithArgs(
self._AddDefaultArgs(['--enable-experimental-web-platform-features']))
self.RestartBrowserIfNecessaryWithArgs(self._AddDefaultArgs([]))
[cba.ENABLE_EXPERIMENTAL_WEB_PLATFORM_FEATURES])
self.RestartBrowserIfNecessaryWithArgs([])
self._NavigateAndWaitForLoad(test_path)
self._KillGPUProcess(1, False)
self._WaitForTabAndCheckCompletion()
self._RestartBrowser('must restart after tests that kill the GPU process')
def _ContextLost_WorkerRAFAfterGPUCrash_OOPD(self, test_path):
self.RestartBrowserIfNecessaryWithArgs(
self._AddDefaultArgs([
'--enable-viz-display-compositor',
'--enable-experimental-web-platform-features'
]))
self.RestartBrowserIfNecessaryWithArgs([
'--enable-viz-display-compositor',
cba.ENABLE_EXPERIMENTAL_WEB_PLATFORM_FEATURES,
])
self._NavigateAndWaitForLoad(test_path)
self._KillGPUProcess(1, False)
self._WaitForTabAndCheckCompletion()
......@@ -377,7 +382,7 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
def _ContextLost_WebGL2Blocked(self, test_path):
self.RestartBrowserIfNecessaryWithArgs(
self._AddDefaultArgs(['--gpu-driver-bug-list-test-group=3']))
['--gpu-driver-bug-list-test-group=3'])
self._NavigateAndWaitForLoad(test_path)
tab = self.tab
tab.EvaluateJavaScript('runTest()')
......@@ -396,7 +401,7 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
logging.info('Skipping test because not running on dual-GPU Mac laptop')
return
# Start with a browser with clean GPU process state.
self.RestartBrowserWithArgs(self._AddDefaultArgs([]))
self.RestartBrowserWithArgs([])
# Wait a few seconds for the system to dispatch any GPU switched
# notifications.
time.sleep(3)
......@@ -417,7 +422,7 @@ class ContextLostIntegrationTest(gpu_integration_test.GpuIntegrationTest):
logging.info('Skipping test because not running on dual-GPU Mac laptop')
return
# Start with a browser with clean GPU process state.
self.RestartBrowserWithArgs(self._AddDefaultArgs([]))
self.RestartBrowserWithArgs([])
# Wait a few seconds for the system to dispatch any GPU switched
# notifications.
time.sleep(3)
......
......@@ -5,6 +5,7 @@
import os
import sys
from gpu_tests import common_browser_args as cba
from gpu_tests import gpu_integration_test
from gpu_tests import path_util
......@@ -73,12 +74,12 @@ class DepthCaptureIntegrationTest(gpu_integration_test.GpuIntegrationTest):
def SetUpProcess(cls):
super(DepthCaptureIntegrationTest, cls).SetUpProcess()
cls.CustomizeBrowserArgs([
'--disable-domain-blocking-for-3d-apis',
cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS,
'--enable-es3-apis',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream=device-count=2',
# Required for about:gpucrash handling from Telemetry.
'--enable-gpu-benchmarking'
cba.ENABLE_GPU_BENCHMARKING,
])
cls.StartBrowser()
cls.SetStaticServerDirs([data_path])
......
......@@ -10,6 +10,7 @@ from telemetry.testing import serially_executed_browser_test_case
from telemetry.util import screenshot
from typ import json_results
from gpu_tests import common_browser_args as cba
from gpu_tests import gpu_helper
_START_BROWSER_RETRIES = 3
......@@ -67,14 +68,72 @@ class GpuIntegrationTest(
help='Disables uploads of logs to cloud storage')
@classmethod
def CustomizeBrowserArgs(cls, browser_args):
"""Customizes the browser's command line arguments.
def GenerateBrowserArgs(cls, additional_args):
"""Generates the browser args to use for the next browser startup.
Child classes are expected to override this and add any additional default
arguments that make sense for that particular class in addition to
the args returned by the parent's implementation.
Args:
additional_args: A list of strings containing any additional, non-default
args to use for the next browser startup.
Returns:
A list of strings containing all the browser arguments to use for the next
browser startup.
"""
default_args = [
'--disable-metal-test-shaders',
]
return default_args + additional_args
@classmethod
def CustomizeBrowserArgs(cls, additional_args=None):
"""Customizes the browser's command line arguments for the next startup.
NOTE that redefining this method in subclasses will NOT do what
you expect! Do not attempt to redefine this method!
Args:
additional_args: A list of strings containing any additional, non-default
args to use for the next browser startup. See the child class'
GenerateBrowserArgs implementation for default arguments.
"""
cls._SetBrowserArgsForNextStartup(
cls._GenerateAndSanitizeBrowserArgs(additional_args))
@classmethod
def _GenerateAndSanitizeBrowserArgs(cls, additional_args=None):
"""Generates browser arguments and sanitizes invalid arguments.
Args:
additional_args: A list of strings containing any additional, non-default
args to use for the next browser startup. See the child class'
GenerateBrowserArgs implementation for default arguments.
Returns:
A list of strings containing all the browser arguments to use for the
next browser startup with invalid arguments removed.
"""
additional_args = additional_args or []
browser_args = cls.GenerateBrowserArgs(additional_args)
if cba.DISABLE_GPU in browser_args:
# Some platforms require GPU process, so browser fails to launch with
# --disable-gpu mode, therefore, even test expectations fail to evaluate.
os_name = cls.browser.platform.GetOSName()
if os_name == 'android' or os_name == 'chromeos':
browser_args.remove(cba.DISABLE_GPU)
return browser_args
@classmethod
def _SetBrowserArgsForNextStartup(cls, browser_args):
"""Sets the browser arguments to use for the next browser startup.
Args:
browser_args: A list of strings containing the browser arguments to use
for the next browser startup.
"""
if not browser_args:
browser_args = []
cls._finder_options = cls.GetOriginalFinderOptions().Copy()
browser_options = cls._finder_options.browser_options
......@@ -88,25 +147,33 @@ class GpuIntegrationTest(
cls.SetBrowserOptions(cls._finder_options)
@classmethod
def RestartBrowserIfNecessaryWithArgs(cls, browser_args, force_restart=False):
if not browser_args:
browser_args = []
elif '--disable-gpu' in browser_args:
# Some platforms require GPU process, so browser fails to launch with
# --disable-gpu mode, therefore, even test expectations fail to evaluate.
browser_args = list(browser_args)
os_name = cls.browser.platform.GetOSName()
if os_name == 'android' or os_name == 'chromeos':
browser_args.remove('--disable-gpu')
if force_restart or set(browser_args) != cls._last_launched_browser_args:
logging.info('Restarting browser with arguments: ' + str(browser_args))
def RestartBrowserIfNecessaryWithArgs(cls,
additional_args=None,
force_restart=False):
"""Restarts the browser if it is determined to be necessary.
A restart is necessary if restarting would cause the browser to run with
different arguments or if it is explicitly forced.
Args:
additional_args: A list of strings containing any additional, non-default
args to use for the next browser startup. See the child class'
GenerateBrowserArgs implementation for default arguments.
force_restart: True to force the browser to restart even if restarting
the browser would not change any browser arguments.
"""
new_browser_args = cls._GenerateAndSanitizeBrowserArgs(additional_args)
if force_restart or set(
new_browser_args) != cls._last_launched_browser_args:
logging.info('Restarting browser with arguments: ' +
str(new_browser_args))
cls.StopBrowser()
cls.CustomizeBrowserArgs(browser_args)
cls._SetBrowserArgsForNextStartup(new_browser_args)
cls.StartBrowser()
@classmethod
def RestartBrowserWithArgs(cls, browser_args):
cls.RestartBrowserIfNecessaryWithArgs(browser_args, force_restart=True)
def RestartBrowserWithArgs(cls, additional_args=None):
cls.RestartBrowserIfNecessaryWithArgs(additional_args, force_restart=True)
# The following is the rest of the framework for the GPU integration tests.
......
......@@ -6,6 +6,7 @@ import json
import os
import sys
from gpu_tests import common_browser_args as cba
from gpu_tests import color_profile_manager
from gpu_tests import gpu_integration_test
from gpu_tests import path_util
......@@ -43,10 +44,10 @@ class MapsIntegrationTest(
color_profile_manager.ForceUntilExitSRGB(
options.dont_restore_color_profile_after_test)
super(MapsIntegrationTest, cls).SetUpProcess()
browser_args = [
'--force-color-profile=srgb', '--ensure-forced-color-profile'
]
cls.CustomizeBrowserArgs(browser_args)
cls.CustomizeBrowserArgs([
cba.FORCE_COLOR_PROFILE_SRGB,
cba.ENSURE_FORCED_COLOR_PROFILE,
])
cloud_storage.GetIfChanged(
os.path.join(_MAPS_PERF_TEST_PATH, 'load_dataset'),
cloud_storage.PUBLIC_BUCKET)
......
......@@ -88,8 +88,7 @@ class PixelIntegrationTest(
# Some pixel tests require non-standard browser arguments. Need to
# check before running each page that it can run in the current
# browser instance.
self.RestartBrowserIfNecessaryWithArgs(
self._AddDefaultArgs(page.browser_args))
self.RestartBrowserIfNecessaryWithArgs(page.browser_args)
url = self.UrlOfStaticFilePath(test_path)
# This property actually comes off the class, not 'self'.
tab = self.tab
......
......@@ -5,6 +5,7 @@
# This is more akin to a .pyl/JSON file, so it's expected to be long.
# pylint: disable=too-many-lines
from gpu_tests import common_browser_args as cba
from gpu_tests import skia_gold_matching_algorithms as algo
CRASH_TYPE_GPU = 'gpu'
......@@ -150,7 +151,7 @@ SCALE_FACTOR_OVERRIDES = {
class PixelTestPages(object):
@staticmethod
def DefaultPages(base_name):
sw_compositing_args = ['--disable-gpu-compositing']
sw_compositing_args = [cba.DISABLE_GPU_COMPOSITING]
# The optimizer script spat out pretty similar values for most MP4 tests, so
# combine into a single set of parameters.
......@@ -218,7 +219,7 @@ class PixelTestPages(object):
# Surprisingly stable, does not appear to require inexact matching.
PixelTestPage('pixel_video_mp4.html',
base_name + '_Video_MP4_DXVA',
browser_args=['--disable-features=D3D11VideoDecoder'],
browser_args=[cba.DISABLE_FEATURES_D3D11_VIDEO_DECODER],
test_rect=[0, 0, 240, 135]),
PixelTestPage('pixel_video_mp4_four_colors_aspect_4x3.html',
base_name + '_Video_MP4_FourColors_Aspect_4x3',
......@@ -255,7 +256,7 @@ class PixelTestPages(object):
edge_threshold=20)),
PixelTestPage('pixel_video_vp9.html',
base_name + '_Video_VP9_DXVA',
browser_args=['--disable-features=D3D11VideoDecoder'],
browser_args=[cba.DISABLE_FEATURES_D3D11_VIDEO_DECODER],
test_rect=[0, 0, 240, 135],
matching_algorithm=algo.SobelMatchingAlgorithm(
max_different_pixels=31100,
......@@ -349,7 +350,8 @@ class PixelTestPages(object):
@staticmethod
def GpuRasterizationPages(base_name):
browser_args = [
'--force-gpu-rasterization', '--disable-software-compositing-fallback'
cba.FORCE_GPU_RASTERIZATION,
cba.DISABLE_SOFTWARE_COMPOSITING_FALLBACK,
]
return [
PixelTestPage('pixel_background.html',
......@@ -390,14 +392,14 @@ class PixelTestPages(object):
@staticmethod
def ExperimentalCanvasFeaturesPages(base_name):
browser_args = [
'--enable-experimental-web-platform-features',
cba.ENABLE_EXPERIMENTAL_WEB_PLATFORM_FEATURES,
]
accelerated_args = [
'--disable-software-compositing-fallback',
cba.DISABLE_SOFTWARE_COMPOSITING_FALLBACK,
]
unaccelerated_args = [
'--disable-accelerated-2d-canvas',
'--disable-gpu-compositing',
cba.DISABLE_ACCELERATED_2D_CANVAS,
cba.DISABLE_GPU_COMPOSITING,
]
return [
......@@ -433,12 +435,12 @@ class PixelTestPages(object):
base_name + '_OffscreenCanvasWebGLSoftwareCompositing',
test_rect=[0, 0, 360, 200],
browser_args=browser_args +
['--disable-gpu-compositing']),
[cba.DISABLE_GPU_COMPOSITING]),
PixelTestPage(
'pixel_offscreenCanvas_webgl_commit_worker.html',
base_name + '_OffscreenCanvasWebGLSoftwareCompositingWorker',
test_rect=[0, 0, 360, 200],
browser_args=browser_args + ['--disable-gpu-compositing']),
browser_args=browser_args + [cba.DISABLE_GPU_COMPOSITING]),
PixelTestPage('pixel_offscreenCanvas_2d_commit_main.html',
base_name + '_OffscreenCanvasAccelerated2D',
test_rect=[0, 0, 360, 200],
......@@ -459,12 +461,12 @@ class PixelTestPages(object):
'pixel_offscreenCanvas_2d_commit_main.html',
base_name + '_OffscreenCanvasUnaccelerated2DGPUCompositing',
test_rect=[0, 0, 360, 200],
browser_args=browser_args + ['--disable-accelerated-2d-canvas']),
browser_args=browser_args + [cba.DISABLE_ACCELERATED_2D_CANVAS]),
PixelTestPage(
'pixel_offscreenCanvas_2d_commit_worker.html',
base_name + '_OffscreenCanvasUnaccelerated2DGPUCompositingWorker',
test_rect=[0, 0, 360, 200],
browser_args=browser_args + ['--disable-accelerated-2d-canvas']),
browser_args=browser_args + [cba.DISABLE_ACCELERATED_2D_CANVAS]),
PixelTestPage('pixel_offscreenCanvas_2d_resize_on_worker.html',
base_name + '_OffscreenCanvas2DResizeOnWorker',
test_rect=[0, 0, 200, 200],
......@@ -485,14 +487,14 @@ class PixelTestPages(object):
'pixel_canvas_display_srgb.html',
base_name + '_CanvasDisplaySRGBUnaccelerated2DGPUCompositing',
test_rect=[0, 0, 140, 140],
browser_args=browser_args + ['--disable-accelerated-2d-canvas']),
browser_args=browser_args + [cba.DISABLE_ACCELERATED_2D_CANVAS]),
]
@staticmethod
def LowLatencyPages(base_name):
unaccelerated_args = [
'--disable-accelerated-2d-canvas',
'--disable-gpu-compositing',
cba.DISABLE_ACCELERATED_2D_CANVAS,
cba.DISABLE_GPU_COMPOSITING,
]
return [
PixelTestPage('pixel_canvas_low_latency_2d.html',
......@@ -523,7 +525,7 @@ class PixelTestPages(object):
# Currently this is Windows and Linux.
@staticmethod
def SwiftShaderPages(base_name):
browser_args = ['--disable-gpu']
browser_args = [cba.DISABLE_GPU]
suffix = "_SwiftShader"
return [
PixelTestPage('pixel_canvas2d.html',
......@@ -547,7 +549,7 @@ class PixelTestPages(object):
# Test rendering where GPU process is blocked.
@staticmethod
def NoGpuProcessPages(base_name):
browser_args = ['--disable-gpu', '--disable-software-rasterizer']
browser_args = [cba.DISABLE_GPU, cba.DISABLE_SOFTWARE_RASTERIZER]
suffix = "_NoGpuProcess"
return [
PixelTestPage(
......@@ -672,12 +674,14 @@ class PixelTestPages(object):
'--enable-direct-composition-video-overlays',
# All bots are connected with a power source, however, we want to to
# test with the code path that's enabled with battery power.
'--disable_vp_scaling=1'
cba.DISABLE_VP_SCALING,
]
browser_args_YUY2 = browser_args + [
'--disable-features=DirectCompositionPreferNV12Overlays'
]
browser_args_DXVA = browser_args + ['--disable-features=D3D11VideoDecoder']
browser_args_DXVA = browser_args + [
cba.DISABLE_FEATURES_D3D11_VIDEO_DECODER
]
# Most tests fall roughly into 3 tiers of noisiness.
# Parameter values were determined using the automated optimization script,
......
......@@ -23,6 +23,7 @@ This script is tested and works fine with the following video sites:
* http://crosvideo.appspot.com
"""
from gpu_tests import common_browser_args as cba
from gpu_tests import gpu_integration_test
from gpu_tests import ipg_utils
from gpu_tests import path_util
......@@ -357,7 +358,7 @@ class PowerMeasurementIntegrationTest(gpu_integration_test.GpuIntegrationTest):
def SetUpProcess(cls):
super(cls, PowerMeasurementIntegrationTest).SetUpProcess()
path_util.SetupTelemetryPaths()
cls.CustomizeBrowserArgs(cls._AddDefaultArgs([]))
cls.CustomizeBrowserArgs([])
cls.StartBrowser()
assert cls._url_mode is not None
if not cls._url_mode:
......@@ -369,10 +370,16 @@ class PowerMeasurementIntegrationTest(gpu_integration_test.GpuIntegrationTest):
prefixed_test_func_name = '_RunTest_%s' % test_params.test_func
getattr(self, prefixed_test_func_name)(test_path, test_params)
@staticmethod
def _AddDefaultArgs(browser_args):
# All tests receive the following options.
return ['--autoplay-policy=no-user-gesture-required'] + browser_args
@classmethod
def GenerateBrowserArgs(cls, additional_args):
"""Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information.
"""
default_args = super(PowerMeasurementIntegrationTest,
cls).GenerateBrowserArgs(additional_args)
default_args.append(cba.AUTOPLAY_POLICY_NO_USER_GESTURE_REQUIRED)
return default_args
@staticmethod
def _MeasurePowerWithIPG(bypass_ipg):
......@@ -427,13 +434,11 @@ class PowerMeasurementIntegrationTest(gpu_integration_test.GpuIntegrationTest):
def _RunTest_Basic(self, test_path, params):
del test_path # Unused in this particular test.
browser_args = PowerMeasurementIntegrationTest._AddDefaultArgs([])
results_sum = {}
for iteration in range(params.repeat):
logging.info('')
logging.info('Iteration #%d', iteration)
self.RestartBrowserWithArgs(browser_args)
self.RestartBrowserWithArgs([])
results = PowerMeasurementIntegrationTest._MeasurePowerWithIPG(
params.bypass_ipg)
......@@ -446,18 +451,17 @@ class PowerMeasurementIntegrationTest(gpu_integration_test.GpuIntegrationTest):
'D3D11VideoDecoder', 'DirectCompositionUseNV12DecodeSwapChain',
'DirectCompositionUnderlays'
]
browser_args = PowerMeasurementIntegrationTest._AddDefaultArgs(
[ # All bots are connected with a power source, however, we want to to
# test with the code path that's enabled with battery power.
'--disable_vp_scaling=1',
'--disable-features=' + ','.join(disabled_features)
])
results_sum = {}
for iteration in range(params.repeat):
logging.info('')
logging.info('Iteration #%d', iteration)
self.RestartBrowserWithArgs(browser_args)
self.RestartBrowserWithArgs([
# All bots are connected with a power source, however, we want to to
# test with the code path that's enabled with battery power.
cba.DISABLE_VP_SCALING,
'--disable-features=' + ','.join(disabled_features)
])
url = self.UrlOfStaticFilePath(test_path)
self.tab.Navigate(url, script_to_evaluate_on_commit=_VIDEO_TEST_SCRIPT)
......
......@@ -8,6 +8,7 @@ import random
import sys
from gpu_tests import color_profile_manager
from gpu_tests import common_browser_args as cba
from gpu_tests import gpu_integration_test
from gpu_tests import path_util
......@@ -60,18 +61,26 @@ class ScreenshotSyncIntegrationTest(gpu_integration_test.GpuIntegrationTest):
color_profile_manager.ForceUntilExitSRGB(
options.dont_restore_color_profile_after_test)
super(cls, ScreenshotSyncIntegrationTest).SetUpProcess()
cls.CustomizeBrowserArgs(cls._AddDefaultArgs([]))
cls.CustomizeBrowserArgs([])
cls.StartBrowser()
cls.SetStaticServerDirs([data_path])
@staticmethod
def _AddDefaultArgs(browser_args):
# --test-type=gpu is used to suppress the "Google API Keys are
# missing" infobar, which causes flakiness in tests.
return [
'--force-color-profile=srgb', '--ensure-forced-color-profile',
'--test-type=gpu'
] + browser_args
@classmethod
def GenerateBrowserArgs(cls, additional_args):
"""Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information.
"""
default_args = super(ScreenshotSyncIntegrationTest,
cls).GenerateBrowserArgs(additional_args)
default_args.extend([
cba.FORCE_COLOR_PROFILE_SRGB,
cba.ENSURE_FORCED_COLOR_PROFILE,
# --test-type=gpu is used to suppress the "Google API Keys are
# missing" infobar, which causes flakiness in tests.
cba.TEST_TYPE_GPU,
])
return default_args
@classmethod
def GenerateGpuTests(cls, options):
......@@ -81,9 +90,9 @@ class ScreenshotSyncIntegrationTest(gpu_integration_test.GpuIntegrationTest):
yield ('ScreenshotSync_SWRasterWithDivs', 'screenshot_sync_divs.html',
('--disable-gpu-rasterization'))
yield ('ScreenshotSync_GPURasterWithCanvas', 'screenshot_sync_canvas.html',
('--force-gpu-rasterization'))
(cba.FORCE_GPU_RASTERIZATION))
yield ('ScreenshotSync_GPURasterWithDivs', 'screenshot_sync_divs.html',
('--force-gpu-rasterization'))
(cba.FORCE_GPU_RASTERIZATION))
def _Navigate(self, test_path):
url = self.UrlOfStaticFilePath(test_path)
......@@ -133,7 +142,7 @@ class ScreenshotSyncIntegrationTest(gpu_integration_test.GpuIntegrationTest):
def RunActualGpuTest(self, test_path, *args):
browser_arg = args[0]
self.RestartBrowserIfNecessaryWithArgs(self._AddDefaultArgs([browser_arg]))
self.RestartBrowserIfNecessaryWithArgs([browser_arg])
self._Navigate(test_path)
repetitions = 20
for _ in range(0, repetitions):
......
......@@ -10,9 +10,10 @@ import shutil
import sys
import tempfile
from gpu_tests import color_profile_manager
from gpu_tests import common_browser_args as cba
from gpu_tests import gpu_integration_test
from gpu_tests import path_util
from gpu_tests import color_profile_manager
from gpu_tests.skia_gold import gpu_skia_gold_properties
from gpu_tests.skia_gold import gpu_skia_gold_session
from gpu_tests.skia_gold import gpu_skia_gold_session_manager
......@@ -79,7 +80,7 @@ class SkiaGoldIntegrationTestBase(gpu_integration_test.GpuIntegrationTest):
color_profile_manager.ForceUntilExitSRGB(
options.dont_restore_color_profile_after_test)
super(SkiaGoldIntegrationTestBase, cls).SetUpProcess()
cls.CustomizeBrowserArgs(cls._AddDefaultArgs([]))
cls.CustomizeBrowserArgs([])
cls.StartBrowser()
cls.SetStaticServerDirs(TEST_DATA_DIRS)
cls._skia_gold_temp_dir = tempfile.mkdtemp()
......@@ -100,20 +101,24 @@ class SkiaGoldIntegrationTestBase(gpu_integration_test.GpuIntegrationTest):
cls._skia_gold_temp_dir, cls.GetSkiaGoldProperties())
return cls._skia_gold_session_manager
@staticmethod
def _AddDefaultArgs(browser_args):
if not browser_args:
browser_args = []
@classmethod
def GenerateBrowserArgs(cls, additional_args):
"""Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information.
"""
default_args = super(SkiaGoldIntegrationTestBase,
cls).GenerateBrowserArgs(additional_args)
default_args.extend([cba.ENABLE_GPU_BENCHMARKING, cba.TEST_TYPE_GPU])
force_color_profile_arg = [
arg for arg in browser_args if arg.startswith('--force-color-profile=')
arg for arg in default_args if arg.startswith('--force-color-profile=')
]
if not force_color_profile_arg:
browser_args = browser_args + [
'--force-color-profile=srgb',
'--ensure-forced-color-profile',
]
# All tests receive the following options.
return browser_args + ['--enable-gpu-benchmarking', '--test-type=gpu']
default_args.extend([
cba.FORCE_COLOR_PROFILE_SRGB,
cba.ENSURE_FORCED_COLOR_PROFILE,
])
return default_args
@classmethod
def StopBrowser(cls):
......
......@@ -5,6 +5,7 @@
import os
import sys
from gpu_tests import common_browser_args as cba
from gpu_tests import gpu_integration_test
from gpu_tests import path_util
from gpu_tests import pixel_test_pages
......@@ -173,7 +174,7 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
# The version of this test in the old GPU test harness restarted
# the browser after each test, so continue to do that to match its
# behavior.
self.RestartBrowserWithArgs(self._AddDefaultArgs(test_params.browser_args))
self.RestartBrowserWithArgs(test_params.browser_args)
# Set up tracing.
config = tracing_config.TracingConfig()
......@@ -206,21 +207,26 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
def SetUpProcess(cls):
super(TraceIntegrationTest, cls).SetUpProcess()
path_util.SetupTelemetryPaths()
cls.CustomizeBrowserArgs(cls._AddDefaultArgs([]))
cls.CustomizeBrowserArgs([])
cls.StartBrowser()
cls.SetStaticServerDirs(data_paths)
@staticmethod
def _AddDefaultArgs(browser_args):
# All tests receive the following options.
default_args = [
@classmethod
def GenerateBrowserArgs(cls, additional_args):
"""Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information.
"""
default_args = super(TraceIntegrationTest,
cls).GenerateBrowserArgs(additional_args)
default_args.extend([
'--enable-logging',
'--enable-experimental-web-platform-features',
cba.ENABLE_EXPERIMENTAL_WEB_PLATFORM_FEATURES,
# All bots are connected with a power source, however, we want to to
# test with the code path that's enabled with battery power.
'--disable_vp_scaling=1'
]
return default_args + (browser_args or [])
cba.DISABLE_VP_SCALING,
])
return default_args
def _GetOverlayBotConfigHelper(self):
system_info = self.browser.GetSystemInfo()
......
......@@ -7,6 +7,7 @@ import os
import re
import sys
from gpu_tests import common_browser_args as cba
from gpu_tests import gpu_helper
from gpu_tests import gpu_integration_test
from gpu_tests import path_util
......@@ -322,14 +323,21 @@ class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
return timeout
@classmethod
def SetupWebGLBrowserArgs(cls, browser_args):
def GenerateBrowserArgs(cls, additional_args):
"""Adds default arguments to |additional_args|.
See the parent class' method documentation for additional information.
"""
default_args = super(WebGLConformanceIntegrationTest,
cls).GenerateBrowserArgs(additional_args)
# --test-type=gpu is used only to suppress the "Google API Keys are missing"
# infobar, which causes flakiness in tests.
browser_args += [
'--autoplay-policy=no-user-gesture-required',
'--disable-domain-blocking-for-3d-apis',
'--disable-gpu-process-crash-limit',
'--test-type=gpu',
default_args.extend([
cba.AUTOPLAY_POLICY_NO_USER_GESTURE_REQUIRED,
cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS,
cba.DISABLE_GPU_PROCESS_CRASH_LIMIT,
cba.TEST_TYPE_GPU,
'--enable-webgl-draft-extensions',
# Try disabling the GPU watchdog to see if this affects the
# intermittent GPU process hangs that have been seen on the
......@@ -341,11 +349,7 @@ class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
# TODO(crbug.com/830901): see whether disabling this feature
# makes the WebGL video upload tests reliable again.
'--disable-features=UseSurfaceLayerForVideo',
# TODO(crbug.com/1085899): promote this to an argument that's
# specified for all of the GPU tests, not just the WebGL
# conformance tests.
'--disable-metal-test-shaders',
]
])
# Note that the overriding of the default --js-flags probably
# won't interact well with RestartBrowserIfNecessaryWithArgs, but
# we don't use that in this test.
......@@ -370,13 +374,14 @@ class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
logging.warning(' Original flags: ' + builtin_js_flags)
logging.warning(' New flags: ' + user_js_flags)
else:
browser_args += [builtin_js_flags]
cls.CustomizeBrowserArgs(browser_args)
default_args.append(builtin_js_flags)
return default_args
@classmethod
def SetUpProcess(cls):
super(WebGLConformanceIntegrationTest, cls).SetUpProcess()
cls.SetupWebGLBrowserArgs([])
cls.CustomizeBrowserArgs([])
cls.StartBrowser()
# By setting multiple server directories, the root of the server
# implicitly becomes the common base directory, i.e., the Chromium
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment