| Index: third_party/WebKit/LayoutTests/csspaint/resources/test-runner-paint-helper.js
|
| diff --git a/third_party/WebKit/LayoutTests/csspaint/resources/test-runner-paint-helper.js b/third_party/WebKit/LayoutTests/csspaint/resources/test-runner-paint-helper.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d5bd770ab78a5f6a36f603dba52f4ae013578afa
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/csspaint/resources/test-runner-paint-helper.js
|
| @@ -0,0 +1,29 @@
|
| +// Given a set of 'tests', runs them in the worklet, then comparing the
|
| +// expectedError or the expectedMessage.
|
| +//
|
| +// Usage:
|
| +// runner([{/* test1 */}, { /* test2 */}]);
|
| +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 if (obj.expectedMessage) {
|
| + console.log('The worklet should log a warning with: "' + obj.expectedMessage + '"');
|
| + } 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();
|
| + }
|
| + });
|
| +}
|
|
|