| 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'; |
| 11 import 'package:analyzer/file_system/memory_file_system.dart'; | 11 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 12 import 'package:analyzer/instrumentation/instrumentation.dart'; | 12 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 13 import 'package:analyzer/src/generated/engine.dart'; |
| 13 import 'package:plugin/manager.dart'; | 14 import 'package:plugin/manager.dart'; |
| 15 import 'package:plugin/plugin.dart'; |
| 14 import 'package:unittest/unittest.dart'; | 16 import 'package:unittest/unittest.dart'; |
| 15 | 17 |
| 16 import 'mock_sdk.dart'; | 18 import 'mock_sdk.dart'; |
| 17 import 'mocks.dart'; | 19 import 'mocks.dart'; |
| 18 import 'utils.dart'; | 20 import 'utils.dart'; |
| 19 | 21 |
| 20 main() { | 22 main() { |
| 21 AnalysisServer server; | 23 AnalysisServer server; |
| 22 DiagnosticDomainHandler handler; | 24 DiagnosticDomainHandler handler; |
| 23 MemoryResourceProvider resourceProvider; | 25 MemoryResourceProvider resourceProvider; |
| 24 | 26 |
| 25 initializeTestEnvironment(); | 27 initializeTestEnvironment(); |
| 26 | 28 |
| 27 setUp(() { | 29 setUp(() { |
| 28 var serverChannel = new MockServerChannel(); | 30 var serverChannel = new MockServerChannel(); |
| 29 resourceProvider = new MemoryResourceProvider(); | 31 resourceProvider = new MemoryResourceProvider(); |
| 30 ExtensionManager manager = new ExtensionManager(); | 32 ExtensionManager manager = new ExtensionManager(); |
| 31 ServerPlugin serverPlugin = new ServerPlugin(); | 33 ServerPlugin serverPlugin = new ServerPlugin(); |
| 32 manager.processPlugins([serverPlugin]); | 34 List<Plugin> plugins = [serverPlugin]; |
| 35 plugins.addAll(AnalysisEngine.instance.supportedPlugins); |
| 36 manager.processPlugins(plugins); |
| 33 server = new AnalysisServer( | 37 server = new AnalysisServer( |
| 34 serverChannel, | 38 serverChannel, |
| 35 resourceProvider, | 39 resourceProvider, |
| 36 new MockPackageMapProvider(), | 40 new MockPackageMapProvider(), |
| 37 null, | 41 null, |
| 38 serverPlugin, | 42 serverPlugin, |
| 39 new AnalysisServerOptions(), | 43 new AnalysisServerOptions(), |
| 40 new MockSdk(), | 44 new MockSdk(), |
| 41 InstrumentationService.NULL_SERVICE); | 45 InstrumentationService.NULL_SERVICE); |
| 42 handler = new DiagnosticDomainHandler(server); | 46 handler = new DiagnosticDomainHandler(server); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 67 }); | 71 }); |
| 68 | 72 |
| 69 test('getDiagnostics - (no root)', () async { | 73 test('getDiagnostics - (no root)', () async { |
| 70 var request = new DiagnosticGetDiagnosticsParams().toRequest('0'); | 74 var request = new DiagnosticGetDiagnosticsParams().toRequest('0'); |
| 71 var response = handler.handleRequest(request); | 75 var response = handler.handleRequest(request); |
| 72 var json = response.toJson()[Response.RESULT]; | 76 var json = response.toJson()[Response.RESULT]; |
| 73 expect(json['contexts'], hasLength(0)); | 77 expect(json['contexts'], hasLength(0)); |
| 74 }); | 78 }); |
| 75 }); | 79 }); |
| 76 } | 80 } |
| OLD | NEW |