| 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 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/source_io.dart'; | 10 import 'package:analyzer/src/generated/source_io.dart'; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 context.results.add(new AnalysisResult([changeNoticeImpl], 0, 'myClass', 0) | 78 context.results.add(new AnalysisResult([changeNoticeImpl], 0, 'myClass', 0) |
| 79 ); | 79 ); |
| 80 context.results.add(new AnalysisResult(null, 0, null, 0)); | 80 context.results.add(new AnalysisResult(null, 0, null, 0)); |
| 81 return pumpEventQueue().then((_) { | 81 return pumpEventQueue().then((_) { |
| 82 expect(context.results, isEmpty); | 82 expect(context.results, isEmpty); |
| 83 expect(channel.notificationsReceived, hasLength(2)); | 83 expect(channel.notificationsReceived, hasLength(2)); |
| 84 expect(channel.notificationsReceived[0].event, equals('server.connected') | 84 expect(channel.notificationsReceived[0].event, equals('server.connected') |
| 85 ); | 85 ); |
| 86 expect(channel.notificationsReceived[1].event, equals('context.errors')); | 86 expect(channel.notificationsReceived[1].event, equals('context.errors')); |
| 87 expect(channel.notificationsReceived[1].params['source'], equals( | 87 expect(channel.notificationsReceived[1].params['source'], equals( |
| 88 '102file:///foo.dart')); // Issue 18739 | 88 source.encoding)); |
| 89 List<AnalysisError> errors = | 89 List<AnalysisError> errors = |
| 90 channel.notificationsReceived[1].params['errors']; | 90 channel.notificationsReceived[1].params['errors']; |
| 91 expect(errors, hasLength(1)); | 91 expect(errors, hasLength(1)); |
| 92 expect(errors[0], equals(analysisError)); | 92 expect(errors[0], equals(analysisError)); |
| 93 }); | 93 }); |
| 94 } | 94 } |
| 95 | 95 |
| 96 static Future addContextToWorkQueue_twice() { | 96 static Future addContextToWorkQueue_twice() { |
| 97 // The context should only be asked to perform its analysis task once. | 97 // The context should only be asked to perform its analysis task once. |
| 98 MockAnalysisContext_withPerformAnalysisTask context = | 98 MockAnalysisContext_withPerformAnalysisTask context = |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 @override | 164 @override |
| 165 Response handleRequest(Request request) { | 165 Response handleRequest(Request request) { |
| 166 if (request.method == 'echo') { | 166 if (request.method == 'echo') { |
| 167 var response = new Response(request.id); | 167 var response = new Response(request.id); |
| 168 response.setResult('echo', true); | 168 response.setResult('echo', true); |
| 169 return response; | 169 return response; |
| 170 } | 170 } |
| 171 return null; | 171 return null; |
| 172 } | 172 } |
| 173 } | 173 } |
| OLD | NEW |