| 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'; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 expect(response.error, isNotNull); | 87 expect(response.error, isNotNull); |
| 88 }); | 88 }); |
| 89 }); | 89 }); |
| 90 | 90 |
| 91 test('rethrow exceptions', () { | 91 test('rethrow exceptions', () { |
| 92 AnalysisServerTestHelper helper = new AnalysisServerTestHelper(); | 92 AnalysisServerTestHelper helper = new AnalysisServerTestHelper(); |
| 93 Exception exceptionToThrow = new Exception('test exception'); | 93 Exception exceptionToThrow = new Exception('test exception'); |
| 94 MockServerOperation operation = new MockServerOperation( | 94 MockServerOperation operation = new MockServerOperation( |
| 95 ServerOperationPriority.ANALYSIS, (_) { throw exceptionToThrow; }); | 95 ServerOperationPriority.ANALYSIS, (_) { throw exceptionToThrow; }); |
| 96 helper.server.operationQueue.add(operation); | 96 helper.server.operationQueue.add(operation); |
| 97 helper.server.operationLoopRunning = true; |
| 97 try { | 98 try { |
| 98 helper.server.performOperation(); | 99 helper.server.performOperation(); |
| 99 fail('exception not rethrown'); | 100 fail('exception not rethrown'); |
| 100 } on AnalysisException catch (exception) { | 101 } on AnalysisException catch (exception) { |
| 101 expect(exception.cause.exception, equals(exceptionToThrow)); | 102 expect(exception.cause.exception, equals(exceptionToThrow)); |
| 102 } | 103 } |
| 103 }); | 104 }); |
| 104 }); | 105 }); |
| 105 } | 106 } |
| 106 | 107 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 118 | 119 |
| 119 class EchoHandler implements RequestHandler { | 120 class EchoHandler implements RequestHandler { |
| 120 @override | 121 @override |
| 121 Response handleRequest(Request request) { | 122 Response handleRequest(Request request) { |
| 122 if (request.method == 'echo') { | 123 if (request.method == 'echo') { |
| 123 return new Response(request.id, result: {'echo': true}); | 124 return new Response(request.id, result: {'echo': true}); |
| 124 } | 125 } |
| 125 return null; | 126 return null; |
| 126 } | 127 } |
| 127 } | 128 } |
| OLD | NEW |