OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script> | 4 <script> |
5 function runner(tests) { | 5 function runner(tests) { |
6 if (window.testRunner) { | 6 if (window.testRunner) { |
7 testRunner.waitUntilDone(); | 7 testRunner.waitUntilDone(); |
8 testRunner.dumpAsText(); | 8 testRunner.dumpAsText(); |
9 } | 9 } |
10 | 10 |
11 tests.reduce(function(chain, obj) { | 11 tests.reduce(function(chain, obj) { |
12 return chain.then(function() { | 12 return chain.then(function() { |
13 if (obj.expectedError) { | 13 if (obj.expectedError) { |
14 console.log('The worklet should throw an error with: "' + obj.ex
pectedError + '"'); | 14 console.log('The worklet should throw an error with: "' + obj.ex
pectedError + '"'); |
| 15 } else if (obj.expectedMessage) { |
| 16 console.log('The worklet should log a warning with: "' + obj.exp
ectedMessage + '"'); |
15 } else { | 17 } else { |
16 console.log('The worklet should not throw an error.'); | 18 console.log('The worklet should not throw an error.'); |
17 } | 19 } |
18 var blob = new Blob([obj.script], {type: 'text/javascript'}); | 20 var blob = new Blob([obj.script], {type: 'text/javascript'}); |
19 return paintWorklet.import(URL.createObjectURL(blob)); | 21 return paintWorklet.import(URL.createObjectURL(blob)); |
20 }); | 22 }); |
21 }, Promise.resolve()).then(function() { | 23 }, Promise.resolve()).then(function() { |
22 if (window.testRunner) { | 24 if (window.testRunner) { |
23 testRunner.notifyDone(); | 25 testRunner.notifyDone(); |
24 } | 26 } |
(...skipping 22 matching lines...) Expand all Loading... |
47 }, { | 49 }, { |
48 expectedError: "The 'paint' function on the prototype does not exist.", | 50 expectedError: "The 'paint' function on the prototype does not exist.", |
49 script: "registerPaint('foo7', class { });", | 51 script: "registerPaint('foo7', class { });", |
50 }, { | 52 }, { |
51 expectedError: "The 'paint' property on the prototype is not a function.
", | 53 expectedError: "The 'paint' property on the prototype is not a function.
", |
52 script: "registerPaint('foo8', class { get paint() { return 42; } });", | 54 script: "registerPaint('foo8', class { get paint() { return 42; } });", |
53 }, { | 55 }, { |
54 script: "registerPaint('foo9', class { paint() { } }); console.log('Succ
ess for \\'foo9\\'.');", | 56 script: "registerPaint('foo9', class { paint() { } }); console.log('Succ
ess for \\'foo9\\'.');", |
55 }, { | 57 }, { |
56 script: "var c = function() { }; c.prototype.paint = function() { }; reg
isterPaint('foo10', c); console.log('Success for \\'foo10\\'.');", | 58 script: "var c = function() { }; c.prototype.paint = function() { }; reg
isterPaint('foo10', c); console.log('Success for \\'foo10\\'.');", |
| 59 }, { |
| 60 expectedMessage: "-webkit-border-radius is a prefixed property which is
not supported.", |
| 61 script: "registerPaint('foo11', class { static get inputProperties() { r
eturn ['-webkit-border-radius']; } paint() { } });" |
57 }]); | 62 }]); |
58 } | 63 } |
59 </script> | 64 </script> |
60 </head> | 65 </head> |
61 <body onload="runTest()"> | 66 <body onload="runTest()"> |
62 <p>This tests a series of PaintWorkletGlobalScope#registerPaint calls.</p> | 67 <p>This tests a series of PaintWorkletGlobalScope#registerPaint calls.</p> |
63 <p>See the devtools console for test output.</p> | 68 <p>See the devtools console for test output.</p> |
64 </body> | 69 </body> |
65 </html> | 70 </html> |
OLD | NEW |