OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library trydart.incremental_compilation_update_test; | 5 library trydart.incremental_compilation_update_test; |
6 | 6 |
7 import 'dart:html' hide | 7 import 'dart:html' hide |
8 Element; | 8 Element; |
9 | 9 |
10 import 'dart:async' show | 10 import 'dart:async' show |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 main() { | 1294 main() { |
1295 // TODO(ahe): Remove next line when new constants are handled correctly. | 1295 // TODO(ahe): Remove next line when new constants are handled correctly. |
1296 [].map(null); | 1296 [].map(null); |
1297 print('v1'); | 1297 print('v1'); |
1298 } | 1298 } |
1299 """, | 1299 """, |
1300 const <String>['v1']), | 1300 const <String>['v1']), |
1301 const ProgramResult( | 1301 const ProgramResult( |
1302 r""" | 1302 r""" |
1303 main() { | 1303 main() { |
1304 // TODO(ahe): Use forEach(print) when closures are computed correctly. | 1304 ['v2'].forEach(print); |
1305 ['v2'].forEach((e) { print(e); }); | |
1306 } | 1305 } |
1307 """, | 1306 """, |
1308 const <String>['v2']), | 1307 const <String>['v2']), |
1309 ], | 1308 ], |
1310 ]; | 1309 ]; |
1311 | 1310 |
1312 void main() { | 1311 void main() { |
1313 listener.start(); | 1312 listener.start(); |
1314 | 1313 |
1315 document.head.append(lineNumberStyle()); | 1314 document.head.append(lineNumberStyle()); |
1316 | 1315 |
| 1316 summary = new SpanElement(); |
| 1317 document.body.append(new HeadingElement.h1() |
| 1318 ..appendText("Incremental compiler tests") |
| 1319 ..append(summary)); |
| 1320 |
1317 String query = window.location.search; | 1321 String query = window.location.search; |
1318 int skip = 0; | 1322 int skip = 0; |
1319 if (query != null && query.length > 1) { | 1323 if (query != null && query.length > 1) { |
1320 query = query.substring(1); | 1324 query = query.substring(1); |
1321 String skipParam = Uri.splitQueryString(window.location.search)['skip']; | 1325 String skipParam = Uri.splitQueryString(window.location.search)['skip']; |
1322 if (skipParam != null) { | 1326 if (skipParam != null) { |
1323 skip = int.parse(skipParam); | 1327 skip = int.parse(skipParam); |
1324 } | 1328 } |
1325 } | 1329 } |
| 1330 testCount += skip; |
1326 | 1331 |
1327 return asyncTest(() => Future.forEach(tests.skip(skip), compileAndRun)); | 1332 return asyncTest(() => Future.forEach(tests.skip(skip), compileAndRun) |
| 1333 .then(updateSummary)); |
1328 } | 1334 } |
1329 | 1335 |
| 1336 SpanElement summary; |
| 1337 |
1330 int testCount = 1; | 1338 int testCount = 1; |
1331 | 1339 |
| 1340 void updateSummary(_) { |
| 1341 summary.text = " (${testCount - 1}/${tests.length})"; |
| 1342 } |
| 1343 |
1332 Future compileAndRun(List<ProgramResult> programs) { | 1344 Future compileAndRun(List<ProgramResult> programs) { |
| 1345 updateSummary(null); |
1333 var status = new DivElement(); | 1346 var status = new DivElement(); |
1334 document.body.append(status); | 1347 document.body.append(status); |
1335 | 1348 |
1336 IFrameElement iframe = | 1349 IFrameElement iframe = |
1337 appendIFrame( | 1350 appendIFrame( |
1338 '/root_dart/tests/try/web/incremental_compilation_update.html', | 1351 '/root_dart/tests/try/web/incremental_compilation_update.html', |
1339 document.body) | 1352 document.body) |
1340 ..style.width = '100%' | 1353 ..style.width = '100%' |
1341 ..style.height = '600px'; | 1354 ..style.height = '600px'; |
1342 | 1355 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 position: absolute; | 1499 position: absolute; |
1487 left: 0px; | 1500 left: 0px; |
1488 width: 3em; | 1501 width: 3em; |
1489 text-align: right; | 1502 text-align: right; |
1490 background-color: lightgoldenrodyellow; | 1503 background-color: lightgoldenrodyellow; |
1491 } | 1504 } |
1492 '''); | 1505 '''); |
1493 style.type = 'text/css'; | 1506 style.type = 'text/css'; |
1494 return style; | 1507 return style; |
1495 } | 1508 } |
OLD | NEW |