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