Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: third_party/WebKit/LayoutTests/csspaint/registerPaint.html

Issue 1839913002: Implement PaintWorkletGlobalScope#registerPaint() for the CSS Paint API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + remove WillBe types. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/csspaint/registerPaint-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/csspaint/registerPaint.html
diff --git a/third_party/WebKit/LayoutTests/csspaint/registerPaint.html b/third_party/WebKit/LayoutTests/csspaint/registerPaint.html
new file mode 100644
index 0000000000000000000000000000000000000000..2bd21d4fdc0d4b69614bed338627efb8ea0b43af
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/csspaint/registerPaint.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function runner(tests) {
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ tests.reduce(function(chain, obj) {
+ return chain.then(function() {
+ if (obj.expectedError) {
+ console.log('The worklet should throw an error with: "' + obj.expectedError + '"');
+ } else {
+ console.log('The worklet should not throw an error.');
+ }
+ var blob = new Blob([obj.script], {type: 'text/javascript'});
+ return paintWorklet.import(URL.createObjectURL(blob));
+ });
+ }, Promise.resolve()).then(function() {
+ if (window.testRunner) {
+ testRunner.notifyDone();
+ }
+ });
+}
+
+function runTest() {
+ runner([{
+ expectedError: "A class with name:'foo' is already registered.",
+ script: "registerPaint('foo', class { paint() { } }); registerPaint('foo', class { paint() { } });",
+ }, {
+ expectedError: "The empty string is not a valid name.",
+ script: "registerPaint('', class { });",
+ }, {
+ expectedError: "failed!",
+ script: "registerPaint('foo3', class { static get inputProperties() { throw Error('failed!'); } });",
+ }, {
+ expectedError: "The value provided is neither an array, nor does it have indexed properties.",
+ script: "registerPaint('foo4', class { static get inputProperties() { return 42; } });",
+ }, {
+ expectedError: "The 'prototype' object on the class does not exist.",
+ script: "var a = function() { }; a.prototype = undefined; registerPaint('foo5', a);",
+ }, {
+ expectedError: "The 'prototype' property on the class is not an object.",
+ script: "var b = function() { }; b.prototype = 42; registerPaint('foo6', b);",
+ }, {
+ expectedError: "The 'paint' function on the prototype does not exist.",
+ script: "registerPaint('foo7', class { });",
+ }, {
+ expectedError: "The 'paint' property on the prototype is not a function.",
+ script: "registerPaint('foo8', class { get paint() { return 42; } });",
+ }, {
+ script: "registerPaint('foo9', class { paint() { } }); console.log('Success for \\'foo9\\'.');",
+ }, {
+ script: "var c = function() { }; c.prototype.paint = function() { }; registerPaint('foo10', c); console.log('Success for \\'foo10\\'.');",
+ }]);
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>This tests a series of PaintWorkletGlobalScope#registerPaint calls.</p>
+<p>See the devtools console for test output.</p>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/csspaint/registerPaint-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698