| 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/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:logging/logging.dart'; | 10 import 'package:logging/logging.dart'; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 var expectedResult = responseJson['result']; | 159 var expectedResult = responseJson['result']; |
| 160 if (!_equal(expectedResult, actualResult)) { | 160 if (!_equal(expectedResult, actualResult)) { |
| 161 var expectedError = responseJson['error']; | 161 var expectedError = responseJson['error']; |
| 162 String format(value) { | 162 String format(value) { |
| 163 String text = '\n$value'; | 163 String text = '\n$value'; |
| 164 if (text.endsWith('\n')) { | 164 if (text.endsWith('\n')) { |
| 165 text = text.substring(0, text.length - 1); | 165 text = text.substring(0, text.length - 1); |
| 166 } | 166 } |
| 167 return text.replaceAll('\n', '\n '); | 167 return text.replaceAll('\n', '\n '); |
| 168 } | 168 } |
| 169 |
| 169 String message = 'Request:${format(requestJson)}\n' | 170 String message = 'Request:${format(requestJson)}\n' |
| 170 'expected result:${format(expectedResult)}\n' | 171 'expected result:${format(expectedResult)}\n' |
| 171 'expected error:${format(expectedError)}\n' | 172 'expected error:${format(expectedError)}\n' |
| 172 'but received:${format(actualResult)}'; | 173 'but received:${format(actualResult)}'; |
| 173 driver.results.recordUnexpectedResults(requestJson['method']); | 174 driver.results.recordUnexpectedResults(requestJson['method']); |
| 174 converter.logOverlayContent(); | 175 converter.logOverlayContent(); |
| 175 if (expectedError == null) { | 176 if (expectedError == null) { |
| 176 converter.logger.log(Level.SEVERE, message); | 177 converter.logger.log(Level.SEVERE, message); |
| 177 } else { | 178 } else { |
| 178 throw message; | 179 throw message; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 subscription.cancel(); | 229 subscription.cancel(); |
| 229 timer.cancel(); | 230 timer.cancel(); |
| 230 String message = 'gave up waiting for analysis to complete'; | 231 String message = 'gave up waiting for analysis to complete'; |
| 231 driver.logger.log(Level.WARNING, message); | 232 driver.logger.log(Level.WARNING, message); |
| 232 completer.completeError(message); | 233 completer.completeError(message); |
| 233 } | 234 } |
| 234 }); | 235 }); |
| 235 return completer.future; | 236 return completer.future; |
| 236 } | 237 } |
| 237 } | 238 } |
| OLD | NEW |