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 '../../reflective_tests.dart'; | 15 import '../../reflective_tests.dart'; |
16 import '../integration_tests.dart'; | 16 import '../integration_tests.dart'; |
17 | 17 |
18 main() { | 18 main() { |
19 runReflectiveTests(Test); | 19 runReflectiveTests(Test); |
20 } | 20 } |
21 | 21 |
22 @ReflectiveTestCase() | 22 @reflectiveTest |
23 class Test extends AbstractAnalysisServerIntegrationTest { | 23 class Test extends AbstractAnalysisServerIntegrationTest { |
24 test_reanalyze_concurrent() { | 24 test_reanalyze_concurrent() { |
25 String pathname = sourcePath('test.dart'); | 25 String pathname = sourcePath('test.dart'); |
26 String text = ''' | 26 String text = ''' |
27 // Do a bunch of imports so that analysis has some work to do. | 27 // Do a bunch of imports so that analysis has some work to do. |
28 import 'dart:io'; | 28 import 'dart:io'; |
29 import 'dart:convert'; | 29 import 'dart:convert'; |
30 import 'dart:async'; | 30 import 'dart:async'; |
31 | 31 |
32 main() {}'''; | 32 main() {}'''; |
33 writeFile(pathname, text); | 33 writeFile(pathname, text); |
34 standardAnalysisSetup(); | 34 standardAnalysisSetup(); |
35 return analysisFinished.then((_) { | 35 return analysisFinished.then((_) { |
36 sendAnalysisReanalyze(); | 36 sendAnalysisReanalyze(); |
37 // Wait for reanalysis to start. | 37 // Wait for reanalysis to start. |
38 return onServerStatus.first.then((_) { | 38 return onServerStatus.first.then((_) { |
39 sendAnalysisReanalyze(); | 39 sendAnalysisReanalyze(); |
40 return analysisFinished.then((_) { | 40 return analysisFinished.then((_) { |
41 // Now that reanalysis has finished, give the server an extra second | 41 // Now that reanalysis has finished, give the server an extra second |
42 // to make sure it doesn't crash. | 42 // to make sure it doesn't crash. |
43 return new Future.delayed(new Duration(seconds: 1)); | 43 return new Future.delayed(new Duration(seconds: 1)); |
44 }); | 44 }); |
45 }); | 45 }); |
46 }); | 46 }); |
47 } | 47 } |
48 } | 48 } |
OLD | NEW |