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

Side by Side 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, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/csspaint/registerPaint-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script>
5 function runner(tests) {
6 if (window.testRunner) {
7 testRunner.waitUntilDone();
8 testRunner.dumpAsText();
9 }
10
11 tests.reduce(function(chain, obj) {
12 return chain.then(function() {
13 if (obj.expectedError) {
14 console.log('The worklet should throw an error with: "' + obj.ex pectedError + '"');
15 } else {
16 console.log('The worklet should not throw an error.');
17 }
18 var blob = new Blob([obj.script], {type: 'text/javascript'});
19 return paintWorklet.import(URL.createObjectURL(blob));
20 });
21 }, Promise.resolve()).then(function() {
22 if (window.testRunner) {
23 testRunner.notifyDone();
24 }
25 });
26 }
27
28 function runTest() {
29 runner([{
30 expectedError: "A class with name:'foo' is already registered.",
31 script: "registerPaint('foo', class { paint() { } }); registerPaint('foo ', class { paint() { } });",
32 }, {
33 expectedError: "The empty string is not a valid name.",
34 script: "registerPaint('', class { });",
35 }, {
36 expectedError: "failed!",
37 script: "registerPaint('foo3', class { static get inputProperties() { th row Error('failed!'); } });",
38 }, {
39 expectedError: "The value provided is neither an array, nor does it have indexed properties.",
40 script: "registerPaint('foo4', class { static get inputProperties() { re turn 42; } });",
41 }, {
42 expectedError: "The 'prototype' object on the class does not exist.",
43 script: "var a = function() { }; a.prototype = undefined; registerPaint( 'foo5', a);",
44 }, {
45 expectedError: "The 'prototype' property on the class is not an object." ,
46 script: "var b = function() { }; b.prototype = 42; registerPaint('foo6', b);",
47 }, {
48 expectedError: "The 'paint' function on the prototype does not exist.",
49 script: "registerPaint('foo7', class { });",
50 }, {
51 expectedError: "The 'paint' property on the prototype is not a function. ",
52 script: "registerPaint('foo8', class { get paint() { return 42; } });",
53 }, {
54 script: "registerPaint('foo9', class { paint() { } }); console.log('Succ ess for \\'foo9\\'.');",
55 }, {
56 script: "var c = function() { }; c.prototype.paint = function() { }; reg isterPaint('foo10', c); console.log('Success for \\'foo10\\'.');",
57 }]);
58 }
59 </script>
60 </head>
61 <body onload="runTest()">
62 <p>This tests a series of PaintWorkletGlobalScope#registerPaint calls.</p>
63 <p>See the devtools console for test output.</p>
64 </body>
65 </html>
OLDNEW
« 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