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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
8 import 'package:analysis_server/protocol/protocol_constants.dart'; | 8 import 'package:analysis_server/protocol/protocol_constants.dart'; |
9 import 'package:analysis_server/protocol/protocol_generated.dart'; | 9 import 'package:analysis_server/protocol/protocol_generated.dart'; |
10 import 'package:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 }); | 109 }); |
110 } | 110 } |
111 | 111 |
112 static SocketServer _createSocketServer() { | 112 static SocketServer _createSocketServer() { |
113 PhysicalResourceProvider resourceProvider = | 113 PhysicalResourceProvider resourceProvider = |
114 PhysicalResourceProvider.INSTANCE; | 114 PhysicalResourceProvider.INSTANCE; |
115 ServerPlugin serverPlugin = new ServerPlugin(); | 115 ServerPlugin serverPlugin = new ServerPlugin(); |
116 ExtensionManager manager = new ExtensionManager(); | 116 ExtensionManager manager = new ExtensionManager(); |
117 manager.processPlugins([serverPlugin]); | 117 manager.processPlugins([serverPlugin]); |
118 return new SocketServer( | 118 return new SocketServer( |
119 new AnalysisServerOptions(), | 119 new AnalysisServerOptions()..addMocks(), |
120 new DartSdkManager('', false), | 120 new DartSdkManager('', false), |
121 new FolderBasedDartSdk(resourceProvider, | 121 new FolderBasedDartSdk(resourceProvider, |
122 FolderBasedDartSdk.defaultSdkDirectory(resourceProvider)), | 122 FolderBasedDartSdk.defaultSdkDirectory(resourceProvider)), |
123 InstrumentationService.NULL_SERVICE, | 123 InstrumentationService.NULL_SERVICE, |
124 null, | 124 null, |
125 serverPlugin, | 125 serverPlugin, |
126 null, | 126 null, |
127 null); | 127 null); |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 class _MockRequestHandler implements RequestHandler { | 131 class _MockRequestHandler implements RequestHandler { |
132 final bool futureException; | 132 final bool futureException; |
133 | 133 |
134 _MockRequestHandler(this.futureException); | 134 _MockRequestHandler(this.futureException); |
135 | 135 |
136 @override | 136 @override |
137 Response handleRequest(Request request) { | 137 Response handleRequest(Request request) { |
138 if (futureException) { | 138 if (futureException) { |
139 new Future(throwException); | 139 new Future(throwException); |
140 return new Response(request.id); | 140 return new Response(request.id); |
141 } | 141 } |
142 throw 'mock request exception'; | 142 throw 'mock request exception'; |
143 } | 143 } |
144 | 144 |
145 void throwException() { | 145 void throwException() { |
146 throw 'mock future exception'; | 146 throw 'mock future exception'; |
147 } | 147 } |
148 } | 148 } |
OLD | NEW |