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.domain.server; | 5 library test.domain.server; |
6 | 6 |
7 import 'package:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
8 import 'package:analysis_server/src/constants.dart'; | 8 import 'package:analysis_server/src/constants.dart'; |
9 import 'package:analysis_server/src/domain_server.dart'; | 9 import 'package:analysis_server/src/domain_server.dart'; |
| 10 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
10 import 'package:analysis_server/src/protocol.dart'; | 11 import 'package:analysis_server/src/protocol.dart'; |
11 import 'package:analyzer/file_system/memory_file_system.dart'; | 12 import 'package:analyzer/file_system/memory_file_system.dart'; |
12 import 'package:analyzer/instrumentation/instrumentation.dart'; | 13 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 14 import 'package:plugin/manager.dart'; |
13 import 'package:unittest/unittest.dart'; | 15 import 'package:unittest/unittest.dart'; |
14 | 16 |
15 import 'mock_sdk.dart'; | 17 import 'mock_sdk.dart'; |
16 import 'mocks.dart'; | 18 import 'mocks.dart'; |
17 | 19 |
18 main() { | 20 main() { |
19 AnalysisServer server; | 21 AnalysisServer server; |
20 ServerDomainHandler handler; | 22 ServerDomainHandler handler; |
21 | 23 |
22 setUp(() { | 24 setUp(() { |
23 var serverChannel = new MockServerChannel(); | 25 var serverChannel = new MockServerChannel(); |
24 var resourceProvider = new MemoryResourceProvider(); | 26 var resourceProvider = new MemoryResourceProvider(); |
| 27 ExtensionManager manager = new ExtensionManager(); |
| 28 ServerPlugin serverPlugin = new ServerPlugin(); |
| 29 manager.processPlugins([serverPlugin]); |
25 server = new AnalysisServer(serverChannel, resourceProvider, | 30 server = new AnalysisServer(serverChannel, resourceProvider, |
26 new MockPackageMapProvider(), null, new AnalysisServerOptions(), | 31 new MockPackageMapProvider(), null, serverPlugin, |
27 new MockSdk(), InstrumentationService.NULL_SERVICE); | 32 new AnalysisServerOptions(), new MockSdk(), |
| 33 InstrumentationService.NULL_SERVICE); |
28 handler = new ServerDomainHandler(server); | 34 handler = new ServerDomainHandler(server); |
29 }); | 35 }); |
30 | 36 |
31 group('ServerDomainHandler', () { | 37 group('ServerDomainHandler', () { |
32 test('getVersion', () { | 38 test('getVersion', () { |
33 var request = new ServerGetVersionParams().toRequest('0'); | 39 var request = new ServerGetVersionParams().toRequest('0'); |
34 var response = handler.handleRequest(request); | 40 var response = handler.handleRequest(request); |
35 expect(response.toJson(), equals({ | 41 expect(response.toJson(), equals({ |
36 Response.ID: '0', | 42 Response.ID: '0', |
37 Response.RESULT: {VERSION: AnalysisServer.VERSION} | 43 Response.RESULT: {VERSION: AnalysisServer.VERSION} |
(...skipping 25 matching lines...) Expand all Loading... |
63 expect(server.running, isTrue); | 69 expect(server.running, isTrue); |
64 // send request | 70 // send request |
65 var request = new ServerShutdownParams().toRequest('0'); | 71 var request = new ServerShutdownParams().toRequest('0'); |
66 var response = handler.handleRequest(request); | 72 var response = handler.handleRequest(request); |
67 expect(response, isResponseSuccess('0')); | 73 expect(response, isResponseSuccess('0')); |
68 // server is down | 74 // server is down |
69 expect(server.running, isFalse); | 75 expect(server.running, isFalse); |
70 }); | 76 }); |
71 }); | 77 }); |
72 } | 78 } |
OLD | NEW |