OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.diagnostic; | 5 library test.domain.diagnostic; |
6 | 6 |
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
8 import 'package:analysis_server/src/analysis_server.dart'; | 8 import 'package:analysis_server/src/analysis_server.dart'; |
9 import 'package:analysis_server/src/domain_diagnostic.dart'; | 9 import 'package:analysis_server/src/domain_diagnostic.dart'; |
10 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 10 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
(...skipping 29 matching lines...) Expand all Loading... |
40 // | 40 // |
41 // Process plugins | 41 // Process plugins |
42 // | 42 // |
43 ExtensionManager manager = new ExtensionManager(); | 43 ExtensionManager manager = new ExtensionManager(); |
44 manager.processPlugins(plugins); | 44 manager.processPlugins(plugins); |
45 // | 45 // |
46 // Create the server | 46 // Create the server |
47 // | 47 // |
48 var serverChannel = new MockServerChannel(); | 48 var serverChannel = new MockServerChannel(); |
49 resourceProvider = new MemoryResourceProvider(); | 49 resourceProvider = new MemoryResourceProvider(); |
| 50 MockSdk sdk = new MockSdk(resourceProvider: resourceProvider); |
50 server = new AnalysisServer( | 51 server = new AnalysisServer( |
51 serverChannel, | 52 serverChannel, |
52 resourceProvider, | 53 resourceProvider, |
53 new MockPackageMapProvider(), | 54 new MockPackageMapProvider(), |
54 null, | 55 null, |
55 serverPlugin, | 56 serverPlugin, |
56 new AnalysisServerOptions(), | 57 new AnalysisServerOptions(), |
57 new DartSdkManager('', false, (_) => new MockSdk()), | 58 new DartSdkManager('/', false, (_) => sdk), |
58 InstrumentationService.NULL_SERVICE); | 59 InstrumentationService.NULL_SERVICE); |
59 handler = new DiagnosticDomainHandler(server); | 60 handler = new DiagnosticDomainHandler(server); |
60 }); | 61 }); |
61 | 62 |
62 group('DiagnosticDomainHandler', () { | 63 group('DiagnosticDomainHandler', () { |
63 test('getDiagnostics', () async { | 64 test('getDiagnostics', () async { |
64 String file = '/project/bin/test.dart'; | 65 String file = '/project/bin/test.dart'; |
65 resourceProvider.newFile('/project/pubspec.yaml', 'name: project'); | 66 resourceProvider.newFile('/project/pubspec.yaml', 'name: project'); |
66 resourceProvider.newFile(file, 'main() {}'); | 67 resourceProvider.newFile(file, 'main() {}'); |
67 | 68 |
(...skipping 17 matching lines...) Expand all Loading... |
85 }); | 86 }); |
86 | 87 |
87 test('getDiagnostics - (no root)', () async { | 88 test('getDiagnostics - (no root)', () async { |
88 var request = new DiagnosticGetDiagnosticsParams().toRequest('0'); | 89 var request = new DiagnosticGetDiagnosticsParams().toRequest('0'); |
89 var response = handler.handleRequest(request); | 90 var response = handler.handleRequest(request); |
90 Map json = response.toJson()[Response.RESULT]; | 91 Map json = response.toJson()[Response.RESULT]; |
91 expect(json['contexts'], hasLength(0)); | 92 expect(json['contexts'], hasLength(0)); |
92 }); | 93 }); |
93 }); | 94 }); |
94 } | 95 } |
OLD | NEW |