| OLD | NEW |
| 1 // Given a piece of 'code', runs it in the worklet, then once loaded waits for | 1 // Given a piece of 'code', runs it in the worklet, then once loaded waits for |
| 2 // layout and paint, before finishing the test. | 2 // layout and paint, before finishing the test. |
| 3 // | 3 // |
| 4 // Usage: | 4 // Usage: |
| 5 // importPaintWorkletAndTerminateTestAfterAsyncPaint('/* worklet code goes her
e. */'); | 5 // importPaintWorkletAndTerminateTestAfterAsyncPaint('/* worklet code goes her
e. */'); |
| 6 | 6 |
| 7 function importPaintWorkletAndTerminateTestAfterAsyncPaint(code) { | 7 function importPaintWorkletAndTerminateTestAfterAsyncPaint(code) { |
| 8 if (window.testRunner) { | 8 if (window.testRunner) { |
| 9 testRunner.waitUntilDone(); | 9 testRunner.waitUntilDone(); |
| 10 } | 10 } |
| 11 | 11 |
| 12 var blob = new Blob([code], {type: 'text/javascript'}); | 12 var blob = new Blob([code], {type: 'text/javascript'}); |
| 13 paintWorklet.addModule(URL.createObjectURL(blob)).then(function() { | 13 paintWorklet.addModule(URL.createObjectURL(blob)).then(function() { |
| 14 runAfterLayoutAndPaint(function() { | 14 runAfterLayoutAndPaint(function() { |
| 15 if (window.testRunner) { | 15 if (window.testRunner) { |
| 16 testRunner.notifyDone(); | 16 testRunner.notifyDone(); |
| 17 } | 17 } |
| 18 }); | 18 }); |
| 19 }); | 19 }); |
| 20 } | 20 } |
| OLD | NEW |