| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 server.operation; | 5 library server.operation; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 import 'package:logging/logging.dart'; | 10 import 'package:logging/logging.dart'; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 if (text.endsWith('\n')) { | 162 if (text.endsWith('\n')) { |
| 163 text = text.substring(0, text.length - 1); | 163 text = text.substring(0, text.length - 1); |
| 164 } | 164 } |
| 165 return text.replaceAll('\n', '\n '); | 165 return text.replaceAll('\n', '\n '); |
| 166 } | 166 } |
| 167 String message = 'Request:${format(requestJson)}\n' | 167 String message = 'Request:${format(requestJson)}\n' |
| 168 'expected result:${format(expectedResult)}\n' | 168 'expected result:${format(expectedResult)}\n' |
| 169 'expected error:${format(expectedError)}\n' | 169 'expected error:${format(expectedError)}\n' |
| 170 'but received:${format(actualResult)}'; | 170 'but received:${format(actualResult)}'; |
| 171 driver.results.recordUnexpectedResults(requestJson['method']); | 171 driver.results.recordUnexpectedResults(requestJson['method']); |
| 172 converter.logOverlayContent(); |
| 172 if (expectedError == null) { | 173 if (expectedError == null) { |
| 173 converter.logger.log(Level.SEVERE, message); | 174 converter.logger.log(Level.SEVERE, message); |
| 174 } else { | 175 } else { |
| 175 throw message; | 176 throw message; |
| 176 } | 177 } |
| 177 } | 178 } |
| 178 } | 179 } |
| 179 } | 180 } |
| 180 | 181 |
| 181 class StartServerOperation extends Operation { | 182 class StartServerOperation extends Operation { |
| 182 final int diagnosticPort; | |
| 183 | |
| 184 StartServerOperation({this.diagnosticPort}); | |
| 185 | |
| 186 @override | 183 @override |
| 187 Future perform(Driver driver) { | 184 Future perform(Driver driver) { |
| 188 return driver.startServer(diagnosticPort: diagnosticPort); | 185 return driver.startServer(); |
| 189 } | 186 } |
| 190 } | 187 } |
| 191 | 188 |
| 192 class WaitForAnalysisCompleteOperation extends Operation { | 189 class WaitForAnalysisCompleteOperation extends Operation { |
| 193 @override | 190 @override |
| 194 Future perform(Driver driver) { | 191 Future perform(Driver driver) { |
| 195 DateTime start = new DateTime.now(); | 192 DateTime start = new DateTime.now(); |
| 196 driver.logger.log(Level.FINE, 'waiting for analysis to complete'); | 193 driver.logger.log(Level.FINE, 'waiting for analysis to complete'); |
| 197 StreamSubscription<ServerStatusParams> subscription; | 194 StreamSubscription<ServerStatusParams> subscription; |
| 198 Timer timer; | 195 Timer timer; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 229 subscription.cancel(); | 226 subscription.cancel(); |
| 230 timer.cancel(); | 227 timer.cancel(); |
| 231 String message = 'gave up waiting for analysis to complete'; | 228 String message = 'gave up waiting for analysis to complete'; |
| 232 driver.logger.log(Level.WARNING, message); | 229 driver.logger.log(Level.WARNING, message); |
| 233 completer.completeError(message); | 230 completer.completeError(message); |
| 234 } | 231 } |
| 235 }); | 232 }); |
| 236 return completer.future; | 233 return completer.future; |
| 237 } | 234 } |
| 238 } | 235 } |
| OLD | NEW |