| 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:analysis_server/src/analysis_server.dart'; | 7 import 'package:analysis_server/src/analysis_server.dart'; |
| 8 import 'package:analysis_server/src/constants.dart'; | 8 import 'package:analysis_server/src/constants.dart'; |
| 9 import 'package:analysis_server/src/domain_server.dart'; | 9 import 'package:analysis_server/src/domain_server.dart'; |
| 10 import 'package:analysis_server/src/operation/operation.dart'; | 10 import 'package:analysis_server/src/operation/operation.dart'; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 AnalysisResult lastResult = new AnalysisResult(null, 1, '', 1); | 34 AnalysisResult lastResult = new AnalysisResult(null, 1, '', 1); |
| 35 when( | 35 when( |
| 36 context.performAnalysisTask).thenReturnList( | 36 context.performAnalysisTask).thenReturnList( |
| 37 [firstResult, firstResult, firstResult, lastResult]); | 37 [firstResult, firstResult, firstResult, lastResult]); |
| 38 helper.server.serverServices.add(ServerService.STATUS); | 38 helper.server.serverServices.add(ServerService.STATUS); |
| 39 helper.server.schedulePerformAnalysisOperation(context); | 39 helper.server.schedulePerformAnalysisOperation(context); |
| 40 // Pump the event queue to make sure the server has finished any | 40 // Pump the event queue to make sure the server has finished any |
| 41 // analysis. | 41 // analysis. |
| 42 return pumpEventQueue().then((_) { | 42 return pumpEventQueue().then((_) { |
| 43 List<Notification> notifications = helper.channel.notificationsReceived; | 43 List<Notification> notifications = helper.channel.notificationsReceived; |
| 44 expect(notifications, isNot(isEmpty)); | 44 expect(notifications, isNotEmpty); |
| 45 // expect at least one notification indicating analysis is in progress | 45 // expect at least one notification indicating analysis is in progress |
| 46 expect(notifications.any((Notification notification) { | 46 expect(notifications.any((Notification notification) { |
| 47 if (notification.event == SERVER_STATUS) { | 47 if (notification.event == SERVER_STATUS) { |
| 48 var params = new ServerStatusParams.fromNotification(notification); | 48 var params = new ServerStatusParams.fromNotification(notification); |
| 49 return params.analysis.isAnalyzing; | 49 return params.analysis.isAnalyzing; |
| 50 } | 50 } |
| 51 return false; | 51 return false; |
| 52 }), isTrue); | 52 }), isTrue); |
| 53 // the last notification should indicate that analysis is complete | 53 // the last notification should indicate that analysis is complete |
| 54 Notification notification = notifications[notifications.length - 1]; | 54 Notification notification = notifications[notifications.length - 1]; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 @override | 217 @override |
| 218 Response handleRequest(Request request) { | 218 Response handleRequest(Request request) { |
| 219 if (request.method == 'echo') { | 219 if (request.method == 'echo') { |
| 220 return new Response(request.id, result: { | 220 return new Response(request.id, result: { |
| 221 'echo': true | 221 'echo': true |
| 222 }); | 222 }); |
| 223 } | 223 } |
| 224 return null; | 224 return null; |
| 225 } | 225 } |
| 226 } | 226 } |
| OLD | NEW |