| OLD | NEW |
| 1 // Test runner for the paint worklet to test invalidation behaviour. | 1 // Test runner for the paint worklet to test invalidation behaviour. |
| 2 // | 2 // |
| 3 // Registers an promise_test per test case, which: | 3 // Registers an promise_test per test case, which: |
| 4 // - Creates an element. | 4 // - Creates an element. |
| 5 // - Invalidates the style of that element. | 5 // - Invalidates the style of that element. |
| 6 // - [worklet] Worklet code logs if it got the invalidation. | 6 // - [worklet] Worklet code logs if it got the invalidation. |
| 7 // - Asserts that it got the correct paint invalidation. | 7 // - Asserts that it got the correct paint invalidation. |
| 8 // | 8 // |
| 9 // Usage: | 9 // Usage: |
| 10 // testRunnerInvalidationLogging('background-image', [ | 10 // testRunnerInvalidationLogging('background-image', [ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 ctx.fillRect(0, 0, geom.width, geom.height); | 25 ctx.fillRect(0, 0, geom.width, geom.height); |
| 26 if (this.hasPainted) { | 26 if (this.hasPainted) { |
| 27 console.log('Successful invalidation for: ' + properties
[i]); | 27 console.log('Successful invalidation for: ' + properties
[i]); |
| 28 } | 28 } |
| 29 this.hasPainted = true; | 29 this.hasPainted = true; |
| 30 } | 30 } |
| 31 }); | 31 }); |
| 32 } | 32 } |
| 33 `; | 33 `; |
| 34 | 34 |
| 35 paintWorklet.addModule(URL.createObjectURL(new Blob([workletCode]))).then(fu
nction() { | 35 paintWorklet.addModule(URL.createObjectURL(new Blob([workletCode], {type: 't
ext/javascript'}))).then(function() { |
| 36 for (let i = 0; i < tests.length; i++) { | 36 for (let i = 0; i < tests.length; i++) { |
| 37 tests[i].paintName = 'paint-' + i; | 37 tests[i].paintName = 'paint-' + i; |
| 38 registerTest(imageType, tests[i]); | 38 registerTest(imageType, tests[i]); |
| 39 } | 39 } |
| 40 }); | 40 }); |
| 41 } | 41 } |
| 42 | 42 |
| 43 function registerTest(imageType, test) { | 43 function registerTest(imageType, test) { |
| 44 const testName = test.property + ': ' + (test.prevValue || '[inline not set]
') + ' => ' + (test.invalidationProperty || test.property) + ': ' + (test.value
|| '[inline not set]'); | 44 const testName = test.property + ': ' + (test.prevValue || '[inline not set]
') + ' => ' + (test.invalidationProperty || test.property) + ': ' + (test.value
|| '[inline not set]'); |
| 45 | 45 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // Cleanup. | 92 // Cleanup. |
| 93 document.body.removeChild(el); | 93 document.body.removeChild(el); |
| 94 resolve(); | 94 resolve(); |
| 95 }); | 95 }); |
| 96 }); | 96 }); |
| 97 | 97 |
| 98 }); | 98 }); |
| 99 | 99 |
| 100 }, testName); | 100 }, testName); |
| 101 } | 101 } |
| OLD | NEW |