| OLD | NEW |
| (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 console.log('The worklet should throw an error with: "' + obj.expect
edError + '"'); |
| 14 var blob = new Blob([obj.script], {type: 'text/javascript'}); |
| 15 return paintWorklet.import(URL.createObjectURL(blob)); |
| 16 }); |
| 17 }, Promise.resolve()).then(function() { |
| 18 if (window.testRunner) { |
| 19 testRunner.notifyDone(); |
| 20 } |
| 21 }); |
| 22 } |
| 23 |
| 24 function runTest() { |
| 25 runner([{ |
| 26 expectedError: "A class with name:'foo' is already registered.", |
| 27 script: "registerPaint('foo', class { }); registerPaint('foo', class { }
);", |
| 28 }, { |
| 29 expectedError: "The empty string is not a valid name.", |
| 30 script: "registerPaint('', class { });", |
| 31 }, { |
| 32 expectedError: "failed!", |
| 33 script: "registerPaint('foo3', class { static get inputProperties() { th
row Error('failed!'); } });", |
| 34 }, { |
| 35 expectedError: "The value provided is neither an array, nor does it have
indexed properties.", |
| 36 script: "registerPaint('foo4', class { static get inputProperties() { re
turn 42; } });", |
| 37 }]); |
| 38 } |
| 39 </script> |
| 40 </head> |
| 41 <body onload="runTest()"> |
| 42 <p>This test imports a </p> |
| 43 </body> |
| 44 </html> |
| OLD | NEW |