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