| 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.server.domain; | 5 library test.integration.server.domain; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/constants.dart'; | 9 import 'package:analysis_server/src/constants.dart'; |
| 10 import 'package:analysis_testing/reflective_tests.dart'; | 10 import 'package:analysis_testing/reflective_tests.dart'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 server.onNotification(SERVER_STATUS).listen((_) { | 42 server.onNotification(SERVER_STATUS).listen((_) { |
| 43 statusReceived = true; | 43 statusReceived = true; |
| 44 }); | 44 }); |
| 45 server.onNotification(ANALYSIS_ERRORS).listen((_) { | 45 server.onNotification(ANALYSIS_ERRORS).listen((_) { |
| 46 if (!analysisBegun.isCompleted) { | 46 if (!analysisBegun.isCompleted) { |
| 47 analysisBegun.complete(); | 47 analysisBegun.complete(); |
| 48 } | 48 } |
| 49 }); | 49 }); |
| 50 return server_setSubscriptions([]).then((response) { | 50 return server_setSubscriptions([]).then((response) { |
| 51 expect(response, isNull); | 51 expect(response, isNull); |
| 52 writeFile('test.dart', ''' | 52 String pathname = sourcePath('test.dart'); |
| 53 writeFile(pathname, ''' |
| 53 main() { | 54 main() { |
| 54 var x; | 55 var x; |
| 55 }'''); | 56 }'''); |
| 56 setAnalysisRoots(['']); | 57 standardAnalysisRoot(); |
| 57 // Analysis should begin, but no server.status notification should be | 58 // Analysis should begin, but no server.status notification should be |
| 58 // received. | 59 // received. |
| 59 return analysisBegun.future.then((_) { | 60 return analysisBegun.future.then((_) { |
| 60 expect(statusReceived, isFalse); | 61 expect(statusReceived, isFalse); |
| 61 return server_setSubscriptions(['STATUS']).then((_) { | 62 return server_setSubscriptions(['STATUS']).then((_) { |
| 62 // Tickle test.dart just in case analysis has already completed. | 63 // Tickle test.dart just in case analysis has already completed. |
| 63 writeFile('test.dart', ''' | 64 writeFile(pathname, ''' |
| 64 main() { | 65 main() { |
| 65 var y; | 66 var y; |
| 66 }'''); | 67 }'''); |
| 67 // Analysis should eventually complete, and we should be notified | 68 // Analysis should eventually complete, and we should be notified |
| 68 // about it. | 69 // about it. |
| 69 return analysisFinished; | 70 return analysisFinished; |
| 70 }); | 71 }); |
| 71 }); | 72 }); |
| 72 }); | 73 }); |
| 73 } | 74 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 if (params['analysis'] != null) { | 106 if (params['analysis'] != null) { |
| 106 if (params['analysis']['analyzing']) { | 107 if (params['analysis']['analyzing']) { |
| 107 expect(analysisBegun.isCompleted, isFalse); | 108 expect(analysisBegun.isCompleted, isFalse); |
| 108 analysisBegun.complete(); | 109 analysisBegun.complete(); |
| 109 } else { | 110 } else { |
| 110 expect(analysisFinished.isCompleted, isFalse); | 111 expect(analysisFinished.isCompleted, isFalse); |
| 111 analysisFinished.complete(); | 112 analysisFinished.complete(); |
| 112 } | 113 } |
| 113 } | 114 } |
| 114 }); | 115 }); |
| 115 writeFile('test.dart', ''' | 116 writeFile(sourcePath('test.dart'), ''' |
| 116 main() { | 117 main() { |
| 117 var x; | 118 var x; |
| 118 }'''); | 119 }'''); |
| 119 setAnalysisRoots(['']); | 120 standardAnalysisRoot(); |
| 120 expect(analysisBegun.isCompleted, isFalse); | 121 expect(analysisBegun.isCompleted, isFalse); |
| 121 expect(analysisFinished.isCompleted, isFalse); | 122 expect(analysisFinished.isCompleted, isFalse); |
| 122 return analysisBegun.future.then((_) { | 123 return analysisBegun.future.then((_) { |
| 123 expect(analysisFinished.isCompleted, isFalse); | 124 expect(analysisFinished.isCompleted, isFalse); |
| 124 return analysisFinished.future; | 125 return analysisFinished.future; |
| 125 }); | 126 }); |
| 126 } | 127 } |
| 127 } | 128 } |
| 128 | 129 |
| 129 main() { | 130 main() { |
| 130 runReflectiveTests(ServerDomainIntegrationTest); | 131 runReflectiveTests(ServerDomainIntegrationTest); |
| 131 } | 132 } |
| OLD | NEW |