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