Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/csspaint/parse-input-arguments.html |
| diff --git a/third_party/WebKit/LayoutTests/csspaint/parse-input-arguments.html b/third_party/WebKit/LayoutTests/csspaint/parse-input-arguments.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cbeb4df982a6632721d0d48552387fc1e46bd678 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/csspaint/parse-input-arguments.html |
| @@ -0,0 +1,50 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<script> |
| +function runner(tests) { |
| + if (window.testRunner) { |
| + testRunner.waitUntilDone(); |
| + testRunner.dumpAsText(); |
| + } |
| + |
| + tests.reduce(function(chain, obj) { |
|
ikilpatrick
2017/01/13 18:50:18
can you pull this out into a common js file?
renjieliu1
2017/01/15 05:05:20
Done.
|
| + 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(); |
| + } |
| + }); |
| +} |
| + |
| +function runTest() { |
| + runner([{ |
| + expectedError: "failed!", |
| + script: "registerPaint('foo', class { static get inputArguments() { throw Error('failed!'); } });", |
| + }, { |
| + expectedError: " Failed to execute 'registerPaint' on 'PaintWorkletGlobalScope': The value provided is neither an array, nor does it have indexed properties.", |
| + script: "registerPaint('foo1', class { static get inputArguments() { return 'non sense stuff'; } });", |
| + }, { |
| + expectedError: "Failed to execute 'registerPaint' on 'PaintWorkletGlobalScope': Invalid argument types.", |
| + script: "registerPaint('foo2', class { static get inputArguments() { return ['<non-sense-type>'] } });", |
| + }, { |
| + script: "registerPaint('foo3', class { static get inputArguments(){return ['<length>'];} paint() { } }); console.log('Success for \\'foo\\'.');", |
| + }]); |
| +} |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +<p>This tests a series of PaintWorkletGlobalScope#registerPaint Parse Input Arguments calls.</p> |
| +<p>See the devtools console for test output.</p> |
| +</body> |
| +</html> |