Commit abf38db9 authored by kbr's avatar kbr Committed by Commit bot

Fold the GPU rasterization tests into the pixel tests step.

This has the side-effect of using the new GPU integration test harness
for these tests.

BUG=352807, 676701
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel
TBR=zmo@chromium.org

Review-Url: https://codereview.chromium.org/2607073002
Cr-Commit-Position: refs/heads/master@{#440947}
parent 6f744e69
......@@ -1123,13 +1123,6 @@ TELEMETRY_TESTS = {
}
],
},
'gpu_rasterization': {
'tester_configs': [
{
'allow_on_android': True,
},
],
},
'hardware_accelerated_feature': {
'tester_configs': [
{
......
# Copyright 2014 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 gpu_tests import cloud_storage_test_base
from gpu_tests import gpu_rasterization_expectations
import page_sets
from telemetry.page import legacy_page_test
from telemetry.util import image_util
test_harness_script = r"""
var domAutomationController = {};
domAutomationController._succeeded = false;
domAutomationController._finished = false;
domAutomationController.setAutomationId = function(id) {}
domAutomationController.send = function(msg) {
domAutomationController._finished = true;
if (msg.toLowerCase() == "success")
domAutomationController._succeeded = true;
else
domAutomationController._succeeded = false;
}
window.domAutomationController = domAutomationController;
"""
def _DidTestSucceed(tab):
return tab.EvaluateJavaScript('domAutomationController._succeeded')
class GpuRasterizationValidator(cloud_storage_test_base.ValidatorBase):
def CustomizeBrowserOptions(self, options):
# --test-type=gpu is used only to suppress the "Google API Keys are missing"
# infobar, which causes flakiness in tests.
options.AppendExtraBrowserArgs(['--force-gpu-rasterization',
'--test-type=gpu'])
def ValidateAndMeasurePage(self, page, tab, results):
if not _DidTestSucceed(tab):
raise legacy_page_test.Failure('Page indicated a failure')
if not hasattr(page, 'expectations') or not page.expectations:
raise legacy_page_test.Failure('Expectations not specified')
if not tab.screenshot_supported:
raise legacy_page_test.Failure(
'Browser does not support screenshot capture')
screenshot = tab.Screenshot()
if screenshot is None:
raise legacy_page_test.Failure('Could not capture screenshot')
device_pixel_ratio = tab.EvaluateJavaScript('window.devicePixelRatio')
if hasattr(page, 'test_rect'):
test_rect = [int(x * device_pixel_ratio) for x in page.test_rect]
screenshot = image_util.Crop(screenshot, test_rect[0], test_rect[1],
test_rect[2], test_rect[3])
self._ValidateScreenshotSamples(
tab,
page.display_name,
screenshot,
page.expectations,
device_pixel_ratio)
class GpuRasterization(cloud_storage_test_base.CloudStorageTestBase):
"""Tests that GPU rasterization produces valid content"""
test = GpuRasterizationValidator
def __init__(self, max_failures=None):
super(GpuRasterization, self).__init__(max_failures=max_failures)
@classmethod
def Name(cls):
return 'gpu_rasterization'
def CreateStorySet(self, options):
story_set = page_sets.GpuRasterizationTestsStorySet(self.GetExpectations())
for page in story_set:
page.script_to_evaluate_on_commit = test_harness_script
return story_set
def _CreateExpectations(self):
return gpu_rasterization_expectations.GpuRasterizationExpectations()
# Copyright 2015 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 gpu_tests.gpu_test_expectations import GpuTestExpectations
# See the GpuTestExpectations class for documentation.
class GpuRasterizationExpectations(GpuTestExpectations):
def SetExpectations(self):
# Sample Usage:
# self.Fail('GpuRasterization.BlueBox',
# ['mac', 'amd', ('nvidia', 0x1234)], bug=123)
# Seems to be flaky on the new AMD R7 240 drivers.
self.Flaky('GpuRasterization.BlueBox',
['win', ('amd', 0x6613)], bug=653538)
# Copyright 2014 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 gpu_tests.gpu_test_expectations import GpuTestExpectations
# See the GpuTestExpectations class for documentation.
class MemoryTestExpectations(GpuTestExpectations):
def SetExpectations(self):
# Sample Usage:
# self.Fail('Memory.CSS3D',
# ['mac', 'amd', ('nvidia', 0x1234)], bug=123)
self.Fail('Memory.CSS3D', bug=435899)
......@@ -12,6 +12,10 @@ class PixelExpectations(GpuTestExpectations):
# self.Fail('Pixel_Canvas2DRedBox',
# ['mac', 'amd', ('nvidia', 0x1234)], bug=123)
# Seems to be flaky on the new AMD R7 240 drivers.
self.Flaky('Pixel_GpuRasterization_BlueBox',
['win', ('amd', 0x6613)], bug=653538)
# Software compositing is not supported on Android; so we skip these tests
# that disables gpu compositing on Android platforms.
self.Skip('Pixel_OffscreenCanvasUnaccelerated2D', ['android'])
......
......@@ -114,6 +114,7 @@ class PixelIntegrationTest(
cls.SetParsedCommandLineOptions(options)
name = 'Pixel'
pages = pixel_test_pages.DefaultPages(name)
pages += pixel_test_pages.GpuRasterizationPages(name)
pages += pixel_test_pages.ExperimentalCanvasFeaturesPages(name)
if sys.platform.startswith('darwin'):
pages += pixel_test_pages.MacSpecificPages(name)
......
......@@ -7,33 +7,33 @@ class PixelTestPage(object):
from the old-style GPU tests.
"""
def __init__(self, url, name, test_rect, revision,
expected_colors=None, tolerance=2, browser_args=None):
tolerance=2, browser_args=None, expected_colors=None):
super(PixelTestPage, self).__init__()
self.url = url
self.name = name
self.test_rect = test_rect
self.revision = revision
# The tolerance when comparing against the reference image.
self.tolerance = tolerance
self.browser_args = browser_args
# The expected colors can be specified as a list of dictionaries,
# in which case these specific pixels will be sampled instead of
# comparing the entire image snapshot. The format is only defined
# by contract with _CompareScreenshotSamples in
# cloud_storage_integration_test_base.py.
self.expected_colors = expected_colors
# The tolerance when comparing against the reference image.
self.tolerance = tolerance
self.browser_args = browser_args
def CopyWithNewBrowserArgsAndSuffix(self, browser_args, suffix):
return PixelTestPage(
self.url, self.name + suffix, self.test_rect, self.revision,
self.expected_colors, self.tolerance, browser_args)
self.tolerance, browser_args, self.expected_colors)
def CopyWithNewBrowserArgsAndPrefix(self, browser_args, prefix):
# Assuming the test name is 'Pixel'.
split = self.name.split('_', 1)
return PixelTestPage(
self.url, split[0] + '_' + prefix + split[1], self.test_rect,
self.revision, self.expected_colors, self.tolerance, browser_args)
self.revision, self.tolerance, browser_args, self.expected_colors)
def CopyPagesWithNewBrowserArgsAndSuffix(pages, browser_args, suffix):
......@@ -133,6 +133,141 @@ def DefaultPages(base_name):
]
# Pages that should be run with GPU rasterization enabled.
def GpuRasterizationPages(base_name):
browser_args = ['--force-gpu-rasterization']
return [
PixelTestPage(
'pixel_background.html',
base_name + '_GpuRasterization_BlueBox',
test_rect=[0, 0, 220, 220],
revision=0, # This is not used.
browser_args=browser_args,
expected_colors=[
{
'comment': 'body-t',
'location': [5, 5],
'size': [1, 1],
'color': [0, 128, 0],
'tolerance': 0
},
{
'comment': 'body-r',
'location': [215, 5],
'size': [1, 1],
'color': [0, 128, 0],
'tolerance': 0
},
{
'comment': 'body-b',
'location': [215, 215],
'size': [1, 1],
'color': [0, 128, 0],
'tolerance': 0
},
{
'comment': 'body-l',
'location': [5, 215],
'size': [1, 1],
'color': [0, 128, 0],
'tolerance': 0
},
{
'comment': 'background-t',
'location': [30, 30],
'size': [1, 1],
'color': [0, 0, 0],
'tolerance': 0
},
{
'comment': 'background-r',
'location': [170, 30],
'size': [1, 1],
'color': [0, 0, 0],
'tolerance': 0
},
{
'comment': 'background-b',
'location': [170, 170],
'size': [1, 1],
'color': [0, 0, 0],
'tolerance': 0
},
{
'comment': 'background-l',
'location': [30, 170],
'size': [1, 1],
'color': [0, 0, 0],
'tolerance': 0
},
{
'comment': 'box-t',
'location': [70, 70],
'size': [1, 1],
'color': [0, 0, 255],
'tolerance': 0
},
{
'comment': 'box-r',
'location': [140, 70],
'size': [1, 1],
'color': [0, 0, 255],
'tolerance': 0
},
{
'comment': 'box-b',
'location': [140, 140],
'size': [1, 1],
'color': [0, 0, 255],
'tolerance': 0
},
{
'comment': 'box-l',
'location': [70, 140],
'size': [1, 1],
'color': [0, 0, 255],
'tolerance': 0
}
]),
PixelTestPage(
'concave_paths.html',
base_name + '_GpuRasterization_ConcavePaths',
test_rect=[0, 0, 100, 100],
revision=0, # This is not used.
browser_args=browser_args,
expected_colors=[
{
'comment': 'outside',
'location': [80, 60],
'size': [1, 1],
'color': [255, 255, 255],
'tolerance': 0
},
{
'comment': 'outside',
'location': [28, 20],
'size': [1, 1],
'color': [255, 255, 255],
'tolerance': 0
},
{
'comment': 'inside',
'location': [32, 25],
'size': [1, 1],
'color': [255, 215, 0],
'tolerance': 0
},
{
'comment': 'inside',
'location': [80, 80],
'size': [1, 1],
'color': [255, 215, 0],
'tolerance': 0
}
])
]
# Pages that should be run with experimental canvas features.
def ExperimentalCanvasFeaturesPages(base_name):
browser_args = ['--enable-experimental-canvas-features']
......
......@@ -8,5 +8,4 @@ from telemetry.core import discover
from telemetry.story import story_set
from page_sets.gpu_process_tests import GpuProcessTestsStorySet
from page_sets.gpu_rasterization_tests import GpuRasterizationTestsStorySet
from page_sets.pixel_tests import PixelTestsStorySet
# Copyright 2014 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.story import story_set as story_set_module
from gpu_tests import gpu_test_base
class GpuRasterizationBlueBoxPage(gpu_test_base.PageBase):
def __init__(self, story_set, expectations):
super(GpuRasterizationBlueBoxPage, self).__init__(
url='file://../../data/gpu/pixel_background.html',
page_set=story_set,
name='GpuRasterization.BlueBox',
expectations=expectations)
self.expectations = [
{'comment': 'body-t',
'color': [0, 128, 0],
'tolerance': 0,
'location': [5, 5],
'size': [1, 1]},
{'comment': 'body-r',
'color': [0, 128, 0],
'tolerance': 0,
'location': [215, 5],
'size': [1, 1]},
{'comment': 'body-b',
'color': [0, 128, 0],
'tolerance': 0,
'location': [215, 215],
'size': [1, 1]},
{'comment': 'body-l',
'color': [0, 128, 0],
'tolerance': 0,
'location': [5, 215],
'size': [1, 1]},
{'comment': 'background-t',
'color': [0, 0, 0],
'tolerance': 0,
'location': [30, 30],
'size': [1, 1]},
{'comment': 'background-r',
'color': [0, 0, 0],
'tolerance': 0,
'location': [170, 30],
'size': [1, 1]},
{'comment': 'background-b',
'color': [0, 0, 0],
'tolerance': 0,
'location': [170, 170],
'size': [1, 1]},
{'comment': 'background-l',
'color': [0, 0, 0],
'tolerance': 0,
'location': [30, 170],
'size': [1, 1]},
{'comment': 'box-t',
'color': [0, 0, 255],
'tolerance': 0,
'location': [70, 70],
'size': [1, 1]},
{'comment': 'box-r',
'color': [0, 0, 255],
'tolerance': 0,
'location': [140, 70],
'size': [1, 1]},
{'comment': 'box-b',
'color': [0, 0, 255],
'tolerance': 0,
'location': [140, 140],
'size': [1, 1]},
{'comment': 'box-l',
'color': [0, 0, 255],
'tolerance': 0,
'location': [70, 140],
'size': [1, 1]}
]
self.test_rect = [0, 0, 220, 220]
def RunNavigateSteps(self, action_runner):
super(GpuRasterizationBlueBoxPage, self).RunNavigateSteps(action_runner)
action_runner.WaitForJavaScriptCondition(
'domAutomationController._finished', timeout_in_seconds=30)
class GpuRasterizationConcavePathsPage(gpu_test_base.PageBase):
def __init__(self, story_set, expectations):
super(GpuRasterizationConcavePathsPage, self).__init__(
url='file://../../data/gpu/concave_paths.html',
page_set=story_set,
name='GpuRasterization.ConcavePaths',
expectations=expectations)
self.expectations = [
{'comment': 'outside',
'color': [255, 255, 255],
'tolerance': 0,
'location': [80, 60],
'size': [1, 1]},
{'comment': 'outside',
'color': [255, 255, 255],
'tolerance': 0,
'location': [28, 20],
'size': [1, 1]},
{'comment': 'inside',
'color': [255, 215, 0],
'tolerance': 0,
'location': [32, 25],
'size': [1, 1]},
{'comment': 'inside',
'color': [255, 215, 0],
'tolerance': 0,
'location': [80, 80],
'size': [1, 1]}
]
self.test_rect = [0, 0, 100, 100]
def RunNavigateSteps(self, action_runner):
super(GpuRasterizationConcavePathsPage, self).RunNavigateSteps(
action_runner)
action_runner.WaitForJavaScriptCondition(
'domAutomationController._finished', timeout_in_seconds=30)
class GpuRasterizationTestsStorySet(story_set_module.StorySet):
""" Basic test cases for GPU rasterization. """
def __init__(self, expectations):
super(GpuRasterizationTestsStorySet, self).__init__()
self.AddStory(GpuRasterizationBlueBoxPage(self, expectations))
self.AddStory(GpuRasterizationConcavePathsPage(self, expectations))
This diff is collapsed.
......@@ -129,29 +129,6 @@
]
}
},
{
"args": [
"gpu_rasterization",
"--show-stdout",
"--browser=debug",
"-v",
"--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc"
],
"isolate_name": "telemetry_gpu_test",
"name": "gpu_rasterization_tests",
"override_compile_targets": [
"telemetry_gpu_test_run"
],
"swarming": {
"can_use_on_swarming_builders": true,
"dimension_sets": [
{
"gpu": "10de:104a",
"os": "Linux"
}
]
}
},
{
"args": [
"hardware_accelerated_feature",
......@@ -450,29 +427,6 @@
]
}
},
{
"args": [
"gpu_rasterization",
"--show-stdout",
"--browser=release",
"-v",
"--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc"
],
"isolate_name": "telemetry_gpu_test",
"name": "gpu_rasterization_tests",
"override_compile_targets": [
"telemetry_gpu_test_run"
],
"swarming": {
"can_use_on_swarming_builders": true,
"dimension_sets": [
{
"gpu": "10de:104a",
"os": "Linux"
}
]
}
},
{
"args": [
"hardware_accelerated_feature",
......@@ -755,29 +709,6 @@
]
}
},
{
"args": [
"gpu_rasterization",
"--show-stdout",
"--browser=debug",
"-v",
"--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc"
],
"isolate_name": "telemetry_gpu_test",
"name": "gpu_rasterization_tests",
"override_compile_targets": [
"telemetry_gpu_test_run"
],
"swarming": {
"can_use_on_swarming_builders": true,
"dimension_sets": [
{
"gpu": "8086:0a2e",
"os": "Mac-10.10"
}
]
}
},
{
"args": [
"hardware_accelerated_feature",
......@@ -1076,29 +1007,6 @@
]
}
},
{
"args": [
"gpu_rasterization",
"--show-stdout",
"--browser=release",
"-v",
"--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc"
],
"isolate_name": "telemetry_gpu_test",
"name": "gpu_rasterization_tests",
"override_compile_targets": [
"telemetry_gpu_test_run"
],
"swarming": {
"can_use_on_swarming_builders": true,
"dimension_sets": [
{
"gpu": "8086:0a2e",
"os": "Mac-10.10"
}
]
}
},
{
"args": [
"hardware_accelerated_feature",
......@@ -1387,30 +1295,6 @@
]
}
},
{
"args": [
"gpu_rasterization",
"--show-stdout",
"--browser=debug",
"-v",
"--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc"
],
"isolate_name": "telemetry_gpu_test",
"name": "gpu_rasterization_tests",
"override_compile_targets": [
"telemetry_gpu_test_run"
],
"swarming": {
"can_use_on_swarming_builders": true,
"dimension_sets": [
{
"gpu": "1002:6821",
"hidpi": "1",
"os": "Mac"
}
]
}
},
{
"args": [
"hardware_accelerated_feature",
......@@ -1722,30 +1606,6 @@
]
}
},
{
"args": [
"gpu_rasterization",
"--show-stdout",
"--browser=release",
"-v",
"--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc"
],
"isolate_name": "telemetry_gpu_test",
"name": "gpu_rasterization_tests",
"override_compile_targets": [
"telemetry_gpu_test_run"
],
"swarming": {
"can_use_on_swarming_builders": true,
"dimension_sets": [
{
"gpu": "1002:6821",
"hidpi": "1",
"os": "Mac"
}
]
}
},
{
"args": [
"hardware_accelerated_feature",
......@@ -2034,29 +1894,6 @@
]
}
},
{
"args": [
"gpu_rasterization",
"--show-stdout",
"--browser=debug",
"-v",
"--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc"
],
"isolate_name": "telemetry_gpu_test",
"name": "gpu_rasterization_tests",
"override_compile_targets": [
"telemetry_gpu_test_run"
],
"swarming": {
"can_use_on_swarming_builders": true,
"dimension_sets": [
{
"gpu": "10de:104a",
"os": "Windows-2008ServerR2-SP1"
}
]
}
},
{
"args": [
"hardware_accelerated_feature",
......@@ -2355,29 +2192,6 @@
]
}
},
{
"args": [
"gpu_rasterization",
"--show-stdout",
"--browser=release",
"-v",
"--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc"
],
"isolate_name": "telemetry_gpu_test",
"name": "gpu_rasterization_tests",
"override_compile_targets": [
"telemetry_gpu_test_run"
],
"swarming": {
"can_use_on_swarming_builders": true,
"dimension_sets": [
{
"gpu": "10de:104a",
"os": "Windows-2008ServerR2-SP1"
}
]
}
},
{
"args": [
"hardware_accelerated_feature",
......
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