Chromium Code Reviews| Index: pkg/analysis_server/test/analysis_server_test.dart |
| diff --git a/pkg/analysis_server/test/analysis_server_test.dart b/pkg/analysis_server/test/analysis_server_test.dart |
| index a4b3fc34ef7114b9a584ef5e2eedc9fad643b38e..b543e81892fceba0dc0c5870b827bfba3bfa0015 100644 |
| --- a/pkg/analysis_server/test/analysis_server_test.dart |
| +++ b/pkg/analysis_server/test/analysis_server_test.dart |
| @@ -79,18 +79,39 @@ class AnalysisServerTest { |
| new AnalysisResult(null, 0, null, 0)); |
| return pumpEventQueue().then((_) { |
| context.getLogs(callsTo('performAnalysisTask')).verify(happenedExactly(2)); |
| - var notifications = channel.notificationsReceived; |
| - expect(notifications, hasLength(2)); |
| + List<Notification> notifications = channel.notificationsReceived; |
| + expect(notifications, hasLength(4)); |
| + |
| expect(notifications[0].event, equals('server.connected')); |
| - expect(notifications[1].event, equals('context.errors')); |
| - expect(notifications[1].params['source'], equals('foo.dart')); |
| - expect(notifications[1].params['contextId'], equals('context-27')); |
| - List<AnalysisError> errors = notifications[1].params['errors']; |
| + |
| + assertStatusNotification(notifications[1], true); |
| + |
| + expect(notifications[2].event, equals('context.errors')); |
| + expect(notifications[2].params['source'], equals('foo.dart')); |
| + expect(notifications[2].params['contextId'], equals('context-27')); |
| + List<AnalysisError> errors = notifications[2].params['errors']; |
| expect(errors, hasLength(1)); |
| expect(errors[0], equals(AnalysisServer.errorToJson(analysisError))); |
| + |
| + assertStatusNotification(notifications[3], false); |
|
Paul Berry
2014/05/23 15:56:45
Not a problem with this test, but a heads up for l
|
| }); |
| } |
| + static void assertStatusNotification(Notification notification, bool expectAnalyzing) { |
| + expect(notification.event, equals('server.status')); |
| + assertNonEmptyString(notification.params['shortMessage']); |
| + assertNonEmptyString(notification.params['longMessage']); |
| + expect(notification.params['isAnalyzing'], equals(expectAnalyzing)); |
| + } |
| + |
| + static void assertNonEmptyString(Object message) { |
| + if (message is String) { |
| + expect(message.length > 0, isTrue); |
| + } else { |
| + fail('Expected String'); |
| + } |
| + } |
| + |
| static Future addContextToWorkQueue_twice() { |
| // The context should only be asked to perform its analysis task once. |
| MockAnalysisContext context = new MockAnalysisContext(); |