OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 benchmarksmoketest; | 5 library benchmarksmoketest; |
6 | 6 |
7 // Tests that benchmark classes used in perf testing are not broken. | 7 // Tests that benchmark classes used in perf testing are not broken. |
8 import 'benchmark_lib.dart'; | 8 import 'benchmark_lib.dart'; |
9 import 'dart:async'; | |
10 import 'dart:html'; | 9 import 'dart:html'; |
11 import '../../pkg/unittest/lib/unittest.dart'; | 10 import '../../pkg/unittest/lib/unittest.dart'; |
12 import '../../pkg/unittest/lib/html_config.dart'; | 11 import '../../pkg/unittest/lib/html_config.dart'; |
13 | 12 |
14 void main() { | 13 void main() { |
15 useHtmlConfiguration(); | 14 useHtmlConfiguration(); |
16 | 15 |
17 test('performanceTesting', () { | 16 test('performanceTesting', () { |
18 Timer.run(BENCHMARK_SUITE.runBenchmarks); | 17 window.setTimeout(BENCHMARK_SUITE.runBenchmarks, 0); |
19 Timer.run(expectAsync0(testForCompletion)); | 18 window.setTimeout(expectAsync0(testForCompletion), 0); |
20 }); | 19 }); |
21 } | 20 } |
22 | 21 |
23 testForCompletion() { | 22 testForCompletion() { |
24 Element element = document.query('#testResultScore'); | 23 Element element = document.query('#testResultScore'); |
25 RegExp re = new RegExp('Score: [0-9]+'); | 24 RegExp re = new RegExp('Score: [0-9]+'); |
26 print(element.text); | 25 print(element.text); |
27 Expect.isTrue(re.hasMatch(element.text)); | 26 Expect.isTrue(re.hasMatch(element.text)); |
28 } | 27 } |
OLD | NEW |