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