gecko-dev/testing/web-platform/tests/css/css-paint-api/parse-input-arguments-018.https.html
Ian Kilpatrick 981ac10754 Bug 1436451 [wpt PR 9427] - [css-layout-api][css-paint-api] Generalize paintWorklet test runner to work with layoutWorklet., a=testonly
Automatic update from web-platform-tests
This should have no behaviour change.

This preparation for some CSS.layoutWorklet reftests.

Change-Id: I0f270a0e60aeadb367abe0ab7ef34e58b3d65096
Reviewed-on: https://chromium-review.googlesource.com/907028
Reviewed-by: Xida Chen <xidachen@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535067}

<!-- Reviewable:start -->

<!-- Reviewable:end -->

wpt-commits: 0bfaa837553a7b66b84b207e702b6b403ad6d990
wpt-pr: 9427
reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2, b81999f30c1516a70c153de51a0331d14c8faead
2018-03-09 10:22:54 +00:00

69 lines
2.4 KiB
HTML

<!DOCTYPE html>
<html class="reftest-wait">
<link rel="match" href="parse-input-arguments-018-ref.html">
<style>
.container {
width: 100px;
height: 100px;
}
#canvas-geometry {
border:1px solid black;
background-image: paint(failureIndicator), paint(geometry);
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>
<body>
<p>This test result should show a rect with black border, where the rect is
filled with green on the lower right corner. The registerPaint('failureIndicator')
will be called twice and the inputArguments will return two different strings,
which will throw an exception and the paint function with 'failureIndicator'
should never be called. In other words, there should be no red painted in the result.</p>
<div id="canvas-geometry" class="container"></div>
<script id="code" type="text/worklet">
function generateRandString(length) {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < length; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
try {
registerPaint('failureIndicator', class {
static get inputArguments() {
// This test is testing the case where an exception should be thrown
// when two paint definitions with different properties are registered
// to the same paint worklet. In order to do that, we randomly generate
// the input properties here. We make the string length 100 to make sure
// that it is veryyyyyyyyyyyy unlikely that two strings will be the same
// when running this test.
var current_str = generateRandString(100);
return [current_str];
}
// The paint function here should never be called because the inputArguments
// will generate two different properties, and that should throw an
// exception.
paint(ctx, geom) {
ctx.fillStyle = 'red';
ctx.fillRect(0, 0, 50, 50);
}
});
} catch(ex) {
}
registerPaint('geometry', class {
paint(ctx, geom) {
ctx.fillStyle = 'green';
ctx.fillRect(50, 50, 50, 50);
}
});
</script>
<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.paintWorklet, document.getElementById('code').textContent);
</script>
</body>
</html>