| 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:analyzer/src/generated/engine.dart'; |
| 14 import 'package:analyzer/src/generated/sdk.dart'; |
| 14 import 'package:plugin/manager.dart'; | 15 import 'package:plugin/manager.dart'; |
| 15 import 'package:plugin/plugin.dart'; | 16 import 'package:plugin/plugin.dart'; |
| 16 import 'package:unittest/unittest.dart'; | 17 import 'package:unittest/unittest.dart'; |
| 17 | 18 |
| 18 import 'mock_sdk.dart'; | 19 import 'mock_sdk.dart'; |
| 19 import 'mocks.dart'; | 20 import 'mocks.dart'; |
| 20 import 'utils.dart'; | 21 import 'utils.dart'; |
| 21 | 22 |
| 22 main() { | 23 main() { |
| 23 AnalysisServer server; | 24 AnalysisServer server; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 46 // | 47 // |
| 47 var serverChannel = new MockServerChannel(); | 48 var serverChannel = new MockServerChannel(); |
| 48 resourceProvider = new MemoryResourceProvider(); | 49 resourceProvider = new MemoryResourceProvider(); |
| 49 server = new AnalysisServer( | 50 server = new AnalysisServer( |
| 50 serverChannel, | 51 serverChannel, |
| 51 resourceProvider, | 52 resourceProvider, |
| 52 new MockPackageMapProvider(), | 53 new MockPackageMapProvider(), |
| 53 null, | 54 null, |
| 54 serverPlugin, | 55 serverPlugin, |
| 55 new AnalysisServerOptions(), | 56 new AnalysisServerOptions(), |
| 56 (_) => new MockSdk(), | 57 new DartSdkManager('', false, (_) => new MockSdk()), |
| 57 InstrumentationService.NULL_SERVICE); | 58 InstrumentationService.NULL_SERVICE); |
| 58 handler = new DiagnosticDomainHandler(server); | 59 handler = new DiagnosticDomainHandler(server); |
| 59 }); | 60 }); |
| 60 | 61 |
| 61 group('DiagnosticDomainHandler', () { | 62 group('DiagnosticDomainHandler', () { |
| 62 test('getDiagnostics', () async { | 63 test('getDiagnostics', () async { |
| 63 String file = '/project/bin/test.dart'; | 64 String file = '/project/bin/test.dart'; |
| 64 resourceProvider.newFile('/project/pubspec.yaml', 'name: project'); | 65 resourceProvider.newFile('/project/pubspec.yaml', 'name: project'); |
| 65 resourceProvider.newFile(file, 'main() {}'); | 66 resourceProvider.newFile(file, 'main() {}'); |
| 66 | 67 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 84 }); | 85 }); |
| 85 | 86 |
| 86 test('getDiagnostics - (no root)', () async { | 87 test('getDiagnostics - (no root)', () async { |
| 87 var request = new DiagnosticGetDiagnosticsParams().toRequest('0'); | 88 var request = new DiagnosticGetDiagnosticsParams().toRequest('0'); |
| 88 var response = handler.handleRequest(request); | 89 var response = handler.handleRequest(request); |
| 89 Map json = response.toJson()[Response.RESULT]; | 90 Map json = response.toJson()[Response.RESULT]; |
| 90 expect(json['contexts'], hasLength(0)); | 91 expect(json['contexts'], hasLength(0)); |
| 91 }); | 92 }); |
| 92 }); | 93 }); |
| 93 } | 94 } |
| OLD | NEW |