| 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 16 matching lines...) Expand all Loading... |
| 27 MockSource source = new MockSource(); | 27 MockSource source = new MockSource(); |
| 28 source.when(callsTo('get fullName')).alwaysReturn('foo.dart'); | 28 source.when(callsTo('get fullName')).alwaysReturn('foo.dart'); |
| 29 source.when(callsTo('get isInSystemLibrary')).alwaysReturn(false); | 29 source.when(callsTo('get isInSystemLibrary')).alwaysReturn(false); |
| 30 ChangeNoticeImpl notice = new ChangeNoticeImpl(source); | 30 ChangeNoticeImpl notice = new ChangeNoticeImpl(source); |
| 31 notice.setErrors([], new LineInfo([0])); | 31 notice.setErrors([], new LineInfo([0])); |
| 32 AnalysisResult firstResult = new AnalysisResult([notice], 0, '', 0); | 32 AnalysisResult firstResult = new AnalysisResult([notice], 0, '', 0); |
| 33 AnalysisResult lastResult = new AnalysisResult(null, 1, '', 1); | 33 AnalysisResult lastResult = new AnalysisResult(null, 1, '', 1); |
| 34 context.when(callsTo("performAnalysisTask")) | 34 context.when(callsTo("performAnalysisTask")) |
| 35 ..thenReturn(firstResult, 3) | 35 ..thenReturn(firstResult, 3) |
| 36 ..thenReturn(lastResult); | 36 ..thenReturn(lastResult); |
| 37 helper.server.serverServices.add(ServerService.STATUS); |
| 37 helper.server.schedulePerformAnalysisOperation(context); | 38 helper.server.schedulePerformAnalysisOperation(context); |
| 38 // Pump the event queue to make sure the server has finished any | 39 // Pump the event queue to make sure the server has finished any |
| 39 // analysis. | 40 // analysis. |
| 40 return pumpEventQueue().then((_) { | 41 return pumpEventQueue().then((_) { |
| 41 List<Notification> notifications = helper.channel.notificationsReceived; | 42 List<Notification> notifications = helper.channel.notificationsReceived; |
| 42 expect(notifications, isNot(isEmpty)); | 43 expect(notifications, isNot(isEmpty)); |
| 43 // expect at least one notification indicating analysis is in progress | 44 // expect at least one notification indicating analysis is in progress |
| 44 expect(notifications.any((Notification notification) { | 45 expect(notifications.any((Notification notification) { |
| 45 if (notification.event == SERVER_STATUS) { | 46 if (notification.event == SERVER_STATUS) { |
| 46 Map analysisStatus = notification.params['analysis']; | 47 Map analysisStatus = notification.params['analysis']; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 var response = new Response(request.id); | 124 var response = new Response(request.id); |
| 124 response.setResult('echo', true); | 125 response.setResult('echo', true); |
| 125 return response; | 126 return response; |
| 126 } | 127 } |
| 127 return null; | 128 return null; |
| 128 } | 129 } |
| 129 } | 130 } |
| OLD | NEW |