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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analysis_server/protocol/protocol_generated.dart'; | 7 import 'package:analysis_server/protocol/protocol_generated.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 |
(...skipping 21 matching lines...) Expand all Loading... |
32 onServerStatus.listen((_) { | 32 onServerStatus.listen((_) { |
33 statusReceived = true; | 33 statusReceived = true; |
34 }); | 34 }); |
35 onAnalysisErrors.listen((_) { | 35 onAnalysisErrors.listen((_) { |
36 if (!analysisBegun.isCompleted) { | 36 if (!analysisBegun.isCompleted) { |
37 analysisBegun.complete(); | 37 analysisBegun.complete(); |
38 } | 38 } |
39 }); | 39 }); |
40 return sendServerSetSubscriptions([]).then((_) { | 40 return sendServerSetSubscriptions([]).then((_) { |
41 String pathname = sourcePath('test.dart'); | 41 String pathname = sourcePath('test.dart'); |
42 writeFile( | 42 writeFile(pathname, ''' |
43 pathname, | |
44 ''' | |
45 main() { | 43 main() { |
46 var x; | 44 var x; |
47 }'''); | 45 }'''); |
48 standardAnalysisSetup(subscribeStatus: false); | 46 standardAnalysisSetup(subscribeStatus: false); |
49 // Analysis should begin, but no server.status notification should be | 47 // Analysis should begin, but no server.status notification should be |
50 // received. | 48 // received. |
51 return analysisBegun.future.then((_) { | 49 return analysisBegun.future.then((_) { |
52 expect(statusReceived, isFalse); | 50 expect(statusReceived, isFalse); |
53 return sendServerSetSubscriptions([ServerService.STATUS]).then((_) { | 51 return sendServerSetSubscriptions([ServerService.STATUS]).then((_) { |
54 // Tickle test.dart just in case analysis has already completed. | 52 // Tickle test.dart just in case analysis has already completed. |
55 writeFile( | 53 writeFile(pathname, ''' |
56 pathname, | |
57 ''' | |
58 main() { | 54 main() { |
59 var y; | 55 var y; |
60 }'''); | 56 }'''); |
61 // Analysis should eventually complete, and we should be notified | 57 // Analysis should eventually complete, and we should be notified |
62 // about it. | 58 // about it. |
63 return analysisFinished; | 59 return analysisFinished; |
64 }); | 60 }); |
65 }); | 61 }); |
66 }); | 62 }); |
67 } | 63 } |
68 } | 64 } |
OLD | NEW |