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 /** | 5 /** |
6 * This test verifies that if reanalysis is performed while reanalysis is in | 6 * This test verifies that if reanalysis is performed while reanalysis is in |
7 * progress, no problems occur. | 7 * progress, no problems occur. |
8 * | 8 * |
9 * See dartbug.com/21448. | 9 * See dartbug.com/21448. |
10 */ | 10 */ |
11 library test.integration.analysis.reanalyze_concurrent; | 11 library test.integration.analysis.reanalyze_concurrent; |
12 | 12 |
13 import 'dart:async'; | 13 import 'dart:async'; |
14 | 14 |
15 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 15 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
16 | 16 |
17 import '../../utils.dart'; | 17 import '../../utils.dart'; |
18 import '../integration_tests.dart'; | 18 import '../integration_tests.dart'; |
19 | 19 |
20 main() { | 20 main() { |
21 initializeTestEnvironment(); | 21 initializeTestEnvironment(); |
22 defineReflectiveTests(Test); | 22 defineReflectiveSuite(() { |
| 23 defineReflectiveTests(Test); |
| 24 }); |
23 } | 25 } |
24 | 26 |
25 @reflectiveTest | 27 @reflectiveTest |
26 class Test extends AbstractAnalysisServerIntegrationTest { | 28 class Test extends AbstractAnalysisServerIntegrationTest { |
27 test_reanalyze_concurrent() { | 29 test_reanalyze_concurrent() { |
28 String pathname = sourcePath('test.dart'); | 30 String pathname = sourcePath('test.dart'); |
29 String text = ''' | 31 String text = ''' |
30 // Do a bunch of imports so that analysis has some work to do. | 32 // Do a bunch of imports so that analysis has some work to do. |
31 import 'dart:io'; | 33 import 'dart:io'; |
32 import 'dart:convert'; | 34 import 'dart:convert'; |
33 import 'dart:async'; | 35 import 'dart:async'; |
34 | 36 |
35 main() {}'''; | 37 main() {}'''; |
36 writeFile(pathname, text); | 38 writeFile(pathname, text); |
37 standardAnalysisSetup(); | 39 standardAnalysisSetup(); |
38 return analysisFinished.then((_) { | 40 return analysisFinished.then((_) { |
39 sendAnalysisReanalyze(); | 41 sendAnalysisReanalyze(); |
40 // Wait for reanalysis to start. | 42 // Wait for reanalysis to start. |
41 return onServerStatus.first.then((_) { | 43 return onServerStatus.first.then((_) { |
42 sendAnalysisReanalyze(); | 44 sendAnalysisReanalyze(); |
43 return analysisFinished.then((_) { | 45 return analysisFinished.then((_) { |
44 // Now that reanalysis has finished, give the server an extra second | 46 // Now that reanalysis has finished, give the server an extra second |
45 // to make sure it doesn't crash. | 47 // to make sure it doesn't crash. |
46 return new Future.delayed(new Duration(seconds: 1)); | 48 return new Future.delayed(new Duration(seconds: 1)); |
47 }); | 49 }); |
48 }); | 50 }); |
49 }); | 51 }); |
50 } | 52 } |
51 } | 53 } |
OLD | NEW |