| 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 library test.integration.analysis.reanalyze; | 5 library test.integration.analysis.reanalyze; |
| 6 | 6 |
| 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 8 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
| 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 10 | 10 |
| 11 import '../../utils.dart'; | |
| 12 import '../integration_tests.dart'; | 11 import '../integration_tests.dart'; |
| 13 | 12 |
| 14 main() { | 13 main() { |
| 15 initializeTestEnvironment(); | |
| 16 defineReflectiveSuite(() { | 14 defineReflectiveSuite(() { |
| 17 defineReflectiveTests(Test); | 15 defineReflectiveTests(Test); |
| 18 }); | 16 }); |
| 19 } | 17 } |
| 20 | 18 |
| 21 @reflectiveTest | 19 @reflectiveTest |
| 22 class Test extends AbstractAnalysisServerIntegrationTest { | 20 class Test extends AbstractAnalysisServerIntegrationTest { |
| 23 test_reanalyze() { | 21 test_reanalyze() { |
| 24 String pathname = sourcePath('test.dart'); | 22 String pathname = sourcePath('test.dart'); |
| 25 String text = 'main() {}'; | 23 String text = 'main() {}'; |
| 26 writeFile(pathname, text); | 24 writeFile(pathname, text); |
| 27 standardAnalysisSetup(); | 25 standardAnalysisSetup(); |
| 28 return analysisFinished.then((_) { | 26 return analysisFinished.then((_) { |
| 29 // Make sure that reanalyze causes analysis to restart. | 27 // Make sure that reanalyze causes analysis to restart. |
| 30 bool analysisRestarted = false; | 28 bool analysisRestarted = false; |
| 31 onServerStatus.listen((ServerStatusParams data) { | 29 onServerStatus.listen((ServerStatusParams data) { |
| 32 if (data.analysis != null) { | 30 if (data.analysis != null) { |
| 33 if (data.analysis.isAnalyzing) { | 31 if (data.analysis.isAnalyzing) { |
| 34 analysisRestarted = true; | 32 analysisRestarted = true; |
| 35 } | 33 } |
| 36 } | 34 } |
| 37 }); | 35 }); |
| 38 sendAnalysisReanalyze(); | 36 sendAnalysisReanalyze(); |
| 39 return analysisFinished.then((_) { | 37 return analysisFinished.then((_) { |
| 40 expect(analysisRestarted, isTrue); | 38 expect(analysisRestarted, isTrue); |
| 41 }); | 39 }); |
| 42 }); | 40 }); |
| 43 } | 41 } |
| 44 } | 42 } |
| OLD | NEW |