Commit 00767652 authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

[OT-PW] add a gpu pixel test

This CL adds a gpu pixel test for off-thread paint worklet, which
contains basic draw and transform operations. This test serves
as preventing regression before shipping off-thread paint worklet,
it also ensures that we would get consistent results cross platforms.

Bug: 829967
Change-Id: I0597213905630b84391157b134982a19b2215cc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1992311Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729873}
parent 7af96c8f
<!DOCTYPE HTML>
<!-- READ BEFORE UPDATING:
If this test is updated make sure to increment the "revision" value of the
associated test in content/test/gpu/gpu_tests/pixel_test_pages.py. This will ensure
that the baseline images are regenerated on the next run.
-->
<html>
<head>
<title>PaintWorklet with basic draw and transform operations</title>
<style type="text/css">
.nomargin {
margin: 0px auto;
width:300px;
height:300px;
background-image:paint(basic);
}
</style>
<script id="code" type="text/worklet">
registerPaint('basic', class {
paint(ctx, geom) {
ctx.fillStyle = 'green';
ctx.transform(1, 0.5, 0, 1, 20, 20);
ctx.fillRect(0, 0, 200, 200);
}
});
</script>
<script>
var g_swapsBeforeAck = 15;
function main()
{
var code = document.getElementById('code').textContent;
var blob = new Blob([code], {type: 'text/javascript'});
CSS.paintWorklet.addModule(URL.createObjectURL(blob)).then(function() {
});
waitForFinish();
}
function waitForFinish()
{
// This tests need paint worklet implemented.
if (g_swapsBeforeAck == 0 || typeof CSS.paintWorklet === 'undefined') {
domAutomationController.send("SUCCESS");
} else {
g_swapsBeforeAck--;
document.getElementById('container').style.zIndex = g_swapsBeforeAck + 1;
window.requestAnimationFrame(waitForFinish);
}
}
</script>
</head>
<body onload="main()">
<div style="position:relative; width:300px; height:300px; background-color:white">
</div>
<div id="container" style="position:absolute; top:0px; left:0px">
<div id="target" class="nomargin"></div>
</div>
</body>
</html>
......@@ -58,6 +58,7 @@ class PixelIntegrationTest(
pages = namespace.DefaultPages(cls.test_base_name)
pages += namespace.GpuRasterizationPages(cls.test_base_name)
pages += namespace.ExperimentalCanvasFeaturesPages(cls.test_base_name)
pages += namespace.PaintWorkletPages(cls.test_base_name)
# pages += namespace.NoGpuProcessPages(cls.test_base_name)
# The following pages should run only on platforms where SwiftShader is
# enabled. They are skipped on other platforms through test expectations.
......
......@@ -788,6 +788,22 @@ class PixelTestPages(object):
browser_args=browser_args)
]
# Pages that should be run with off-thread paint worklet flags.
@staticmethod
def PaintWorkletPages(base_name):
browser_args = [
'--enable-blink-features=OffMainThreadCSSPaint',
'--enable-gpu-rasterization',
'--enable-oop-rasterization']
return [
PixelTestPage(
'pixel_paintWorklet_basics.html',
base_name + '_PaintWorkletBasics',
test_rect=[0, 0, 300, 300],
browser_args=browser_args),
]
# Pages that should be run with experimental canvas features.
@staticmethod
def ExperimentalCanvasFeaturesPages(base_name):
......
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