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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 expect(channel.notificationsReceived[1].event, SERVER_ERROR); | 104 expect(channel.notificationsReceived[1].event, SERVER_ERROR); |
105 }); | 105 }); |
106 } | 106 } |
107 | 107 |
108 static SocketServer _createSocketServer() { | 108 static SocketServer _createSocketServer() { |
109 ServerPlugin serverPlugin = new ServerPlugin(); | 109 ServerPlugin serverPlugin = new ServerPlugin(); |
110 ExtensionManager manager = new ExtensionManager(); | 110 ExtensionManager manager = new ExtensionManager(); |
111 manager.processPlugins([serverPlugin]); | 111 manager.processPlugins([serverPlugin]); |
112 return new SocketServer(new AnalysisServerOptions(), | 112 return new SocketServer(new AnalysisServerOptions(), |
113 DirectoryBasedDartSdk.defaultSdk, InstrumentationService.NULL_SERVICE, | 113 DirectoryBasedDartSdk.defaultSdk, InstrumentationService.NULL_SERVICE, |
114 serverPlugin, null); | 114 serverPlugin, null, null); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 class _MockRequestHandler implements RequestHandler { | 118 class _MockRequestHandler implements RequestHandler { |
119 final bool futureException; | 119 final bool futureException; |
120 | 120 |
121 _MockRequestHandler(this.futureException); | 121 _MockRequestHandler(this.futureException); |
122 | 122 |
123 @override | 123 @override |
124 Response handleRequest(Request request) { | 124 Response handleRequest(Request request) { |
125 if (futureException) { | 125 if (futureException) { |
126 new Future(throwException); | 126 new Future(throwException); |
127 return new Response(request.id); | 127 return new Response(request.id); |
128 } | 128 } |
129 throw 'mock request exception'; | 129 throw 'mock request exception'; |
130 } | 130 } |
131 | 131 |
132 void throwException() { | 132 void throwException() { |
133 throw 'mock future exception'; | 133 throw 'mock future exception'; |
134 } | 134 } |
135 } | 135 } |
OLD | NEW |