OLD | NEW |
1 library dromaeo_test; | 1 library dromaeo_test; |
2 | 2 |
3 import 'dart:html'; | 3 import 'dart:html'; |
4 import 'dart:async'; | 4 import 'dart:async'; |
5 import "dart:convert"; | 5 import "dart:convert"; |
6 import 'dart:math' as Math; | 6 import 'dart:math' as Math; |
| 7 import 'dart:js' as js; |
7 import 'Suites.dart'; | 8 import 'Suites.dart'; |
8 | 9 |
9 main() { | 10 main() { |
10 new Dromaeo().run(); | 11 new Dromaeo().run(); |
11 } | 12 } |
12 | 13 |
13 class SuiteController { | 14 class SuiteController { |
14 final SuiteDescription _suiteDescription; | 15 final SuiteDescription _suiteDescription; |
15 final IFrameElement _suiteIframe; | 16 final IFrameElement _suiteIframe; |
16 | 17 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 _updateTime(); | 195 _updateTime(); |
195 return running; | 196 return running; |
196 | 197 |
197 case 'over': | 198 case 'over': |
198 currentSuite++; | 199 currentSuite++; |
199 if (currentSuite < _suitesTotal) { | 200 if (currentSuite < _suitesTotal) { |
200 _suiteControllers[currentSuite].start(); | 201 _suiteControllers[currentSuite].start(); |
201 return running; | 202 return running; |
202 } | 203 } |
203 document.body.attributes['class'] = 'alldone'; | 204 document.body.attributes['class'] = 'alldone'; |
| 205 |
| 206 var report = js.context['reportPerformanceTestDone']; |
| 207 if (report != null) { |
| 208 report.apply([]); |
| 209 } else { |
| 210 // This is not running as a performance test. Continue as normal. |
| 211 window.console.log('Warning: failed to call ' |
| 212 'reportPerformanceTestDone. If this is a performance test, ' |
| 213 'please include ' |
| 214 'packages/browser_controller/perf_test_controller.js in your ' |
| 215 'html file.'); |
| 216 } |
204 return done; | 217 return done; |
205 | 218 |
206 default: | 219 default: |
207 throw 'Unknown command ${command} [${data}]'; | 220 throw 'Unknown command ${command} [${data}]'; |
208 } | 221 } |
209 }; | 222 }; |
210 | 223 |
211 done = (String command, var data) { | 224 done = (String command, var data) { |
212 }; | 225 }; |
213 | 226 |
214 return loading; | 227 return loading; |
215 } | 228 } |
216 | 229 |
217 _css(Element element, String property, String value) { | 230 _css(Element element, String property, String value) { |
218 // TODO(antonm): remove the last argument when CallWithDefaultValue | 231 // TODO(antonm): remove the last argument when CallWithDefaultValue |
219 // is implemented. | 232 // is implemented. |
220 element.style.setProperty(property, value, ''); | 233 element.style.setProperty(property, value, ''); |
221 } | 234 } |
222 | 235 |
223 Element _byId(String id) { | 236 Element _byId(String id) { |
224 return document.querySelector('#$id'); | 237 return document.querySelector('#$id'); |
225 } | 238 } |
226 | 239 |
227 int get _suitesTotal { | 240 int get _suitesTotal { |
228 return _suiteControllers.length; | 241 return _suiteControllers.length; |
229 } | 242 } |
230 } | 243 } |
OLD | NEW |