| 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.socket.server; | 5 library test.socket.server; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 expect(channel.notificationsReceived[0].event, SERVER_CONNECTED); | 88 expect(channel.notificationsReceived[0].event, SERVER_CONNECTED); |
| 89 _MockRequestHandler handler = new _MockRequestHandler(false); | 89 _MockRequestHandler handler = new _MockRequestHandler(false); |
| 90 server.analysisServer.handlers = [handler]; | 90 server.analysisServer.handlers = [handler]; |
| 91 var request = new ServerGetVersionParams().toRequest('0'); | 91 var request = new ServerGetVersionParams().toRequest('0'); |
| 92 return channel.sendRequest(request).then((Response response) { | 92 return channel.sendRequest(request).then((Response response) { |
| 93 expect(response.id, equals('0')); | 93 expect(response.id, equals('0')); |
| 94 expect(response.error, isNotNull); | 94 expect(response.error, isNotNull); |
| 95 expect(response.error.code, equals(RequestErrorCode.SERVER_ERROR)); | 95 expect(response.error.code, equals(RequestErrorCode.SERVER_ERROR)); |
| 96 expect(response.error.message, equals('mock request exception')); | 96 expect(response.error.message, equals('mock request exception')); |
| 97 expect(response.error.stackTrace, isNotNull); | 97 expect(response.error.stackTrace, isNotNull); |
| 98 expect(response.error.stackTrace, isNot(isEmpty)); | 98 expect(response.error.stackTrace, isNotEmpty); |
| 99 channel.expectMsgCount(responseCount: 1, notificationCount: 1); | 99 channel.expectMsgCount(responseCount: 1, notificationCount: 1); |
| 100 }); | 100 }); |
| 101 } | 101 } |
| 102 | 102 |
| 103 static Future requestHandler_futureException() { | 103 static Future requestHandler_futureException() { |
| 104 SocketServer server = new SocketServer( | 104 SocketServer server = new SocketServer( |
| 105 new AnalysisServerOptions(), | 105 new AnalysisServerOptions(), |
| 106 DirectoryBasedDartSdk.defaultSdk, | 106 DirectoryBasedDartSdk.defaultSdk, |
| 107 InstrumentationService.NULL_SERVICE); | 107 InstrumentationService.NULL_SERVICE); |
| 108 MockServerChannel channel = new MockServerChannel(); | 108 MockServerChannel channel = new MockServerChannel(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 130 new Future(throwException); | 130 new Future(throwException); |
| 131 return new Response(request.id); | 131 return new Response(request.id); |
| 132 } | 132 } |
| 133 throw 'mock request exception'; | 133 throw 'mock request exception'; |
| 134 } | 134 } |
| 135 | 135 |
| 136 void throwException() { | 136 void throwException() { |
| 137 throw 'mock future exception'; | 137 throw 'mock future exception'; |
| 138 } | 138 } |
| 139 } | 139 } |
| OLD | NEW |