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