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