OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 class CompositedAnimationTestCommon { | 3 class CompositedAnimationTestCommon { |
4 constructor(composited) { | 4 constructor(composited) { |
5 this.composited = composited; | 5 this.composited = composited; |
6 this.tests = []; | 6 this.tests = []; |
7 this.nextInstanceId = 1; | 7 this.nextInstanceId = 1; |
8 | 8 |
9 this.createStyles(); | 9 this.createStyles(); |
10 this.createStaticElements(); | 10 this.createStaticElements(); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 }); | 132 }); |
133 } | 133 } |
134 | 134 |
135 reportError(test, message) { | 135 reportError(test, message) { |
136 if (!this.error.textContent) | 136 if (!this.error.textContent) |
137 this.error.textContent = `${this.composited ? 'Tests:' : 'TestExpectations
:'} `; | 137 this.error.textContent = `${this.composited ? 'Tests:' : 'TestExpectations
:'} `; |
138 | 138 |
139 this.error.textContent += `${test.name}: ${message} `; | 139 this.error.textContent += `${test.name}: ${message} `; |
140 } | 140 } |
141 | 141 |
| 142 waitForCompositor() { |
| 143 return this.error.animate({opacity: ['1', '1']}, 1).ready; |
| 144 } |
| 145 |
142 layoutAndPaint() { | 146 layoutAndPaint() { |
143 if (window.testRunner) | 147 if (window.testRunner) |
144 testRunner.waitUntilDone(); | 148 testRunner.waitUntilDone(); |
145 | 149 |
146 requestAnimationFrame(() => { | 150 this.waitForCompositor().then(() => { |
147 if (window.internals) | 151 requestAnimationFrame(() => { |
148 this.assertAnimationCompositedState(); | 152 if (window.internals) |
149 if (window.testRunner) | 153 this.assertAnimationCompositedState(); |
150 testRunner.notifyDone(); | 154 if (window.testRunner) |
| 155 testRunner.notifyDone(); |
| 156 }); |
151 }); | 157 }); |
152 } | 158 } |
153 | 159 |
154 registerTestsData(testSuiteData) { | 160 registerTestsData(testSuiteData) { |
155 this.suiteStyle = testSuiteData.style; | 161 this.suiteStyle = testSuiteData.style; |
156 for (var testName in testSuiteData.tests) { | 162 for (var testName in testSuiteData.tests) { |
157 var testData = testSuiteData.tests[testName]; | 163 var testData = testSuiteData.tests[testName]; |
158 this.tests.push({ | 164 this.tests.push({ |
159 name: testName, | 165 name: testName, |
160 data: testData, | 166 data: testData, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 206 } |
201 | 207 |
202 var getLinearSamples = function(n, start, end) { | 208 var getLinearSamples = function(n, start, end) { |
203 var arr = []; | 209 var arr = []; |
204 var spread = end - start; | 210 var spread = end - start; |
205 for (var i = 0; i <= n; i++) | 211 for (var i = 0; i <= n; i++) |
206 arr.push(i * spread / n + start); | 212 arr.push(i * spread / n + start); |
207 return arr.map(t => { return {at: t} }); | 213 return arr.map(t => { return {at: t} }); |
208 } | 214 } |
209 | 215 |
OLD | NEW |