| 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.analysis_server; | 5 library test.analysis_server; |
| 6 | 6 |
| 7 import 'package:analyzer/file_system/physical_file_system.dart'; | 7 import 'package:analyzer/file_system/physical_file_system.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/constants.dart'; | 9 import 'package:analysis_server/src/constants.dart'; |
| 10 import 'package:analysis_server/src/domain_server.dart'; | 10 import 'package:analysis_server/src/domain_server.dart'; |
| 11 import 'package:analysis_server/src/operation/operation.dart'; | 11 import 'package:analysis_server/src/operation/operation.dart'; |
| 12 import 'package:analysis_server/src/protocol.dart'; | 12 import 'package:analysis_server/src/protocol.dart'; |
| 13 import 'package:analysis_testing/mock_sdk.dart'; |
| 13 import 'package:analyzer/src/generated/engine.dart'; | 14 import 'package:analyzer/src/generated/engine.dart'; |
| 14 import 'package:analyzer/src/generated/java_engine.dart'; | 15 import 'package:analyzer/src/generated/java_engine.dart'; |
| 15 import 'package:analyzer/src/generated/source.dart'; | 16 import 'package:analyzer/src/generated/source.dart'; |
| 16 import 'package:mock/mock.dart'; | 17 import 'package:mock/mock.dart'; |
| 17 import 'package:unittest/unittest.dart'; | 18 import 'package:unittest/unittest.dart'; |
| 18 | 19 |
| 19 import 'mocks.dart'; | 20 import 'mocks.dart'; |
| 20 | 21 |
| 21 main() { | 22 main() { |
| 22 group('AnalysisServer', () { | 23 group('AnalysisServer', () { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 }); | 104 }); |
| 104 } | 105 } |
| 105 | 106 |
| 106 class AnalysisServerTestHelper { | 107 class AnalysisServerTestHelper { |
| 107 MockServerChannel channel; | 108 MockServerChannel channel; |
| 108 AnalysisServer server; | 109 AnalysisServer server; |
| 109 | 110 |
| 110 AnalysisServerTestHelper({bool rethrowExceptions: true}) { | 111 AnalysisServerTestHelper({bool rethrowExceptions: true}) { |
| 111 channel = new MockServerChannel(); | 112 channel = new MockServerChannel(); |
| 112 server = new AnalysisServer(channel, PhysicalResourceProvider.INSTANCE, | 113 server = new AnalysisServer(channel, PhysicalResourceProvider.INSTANCE, |
| 113 new MockPackageMapProvider(), null, | 114 new MockPackageMapProvider(), null, new MockSdk(), |
| 114 rethrowExceptions: rethrowExceptions); | 115 rethrowExceptions: rethrowExceptions); |
| 115 } | 116 } |
| 116 } | 117 } |
| 117 | 118 |
| 118 class EchoHandler implements RequestHandler { | 119 class EchoHandler implements RequestHandler { |
| 119 @override | 120 @override |
| 120 Response handleRequest(Request request) { | 121 Response handleRequest(Request request) { |
| 121 if (request.method == 'echo') { | 122 if (request.method == 'echo') { |
| 122 var response = new Response(request.id); | 123 var response = new Response(request.id); |
| 123 response.setResult('echo', true); | 124 response.setResult('echo', true); |
| 124 return response; | 125 return response; |
| 125 } | 126 } |
| 126 return null; | 127 return null; |
| 127 } | 128 } |
| 128 } | 129 } |
| OLD | NEW |