Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: pkg/analysis_server/test/analysis_server_test.dart

Issue 352823005: send status notification when analysis starts and ends (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge and address comments Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/src/generated/engine.dart'; 7 import 'package:analyzer/src/generated/engine.dart';
8 import 'package:analyzer/src/generated/java_engine.dart'; 8 import 'package:analyzer/src/generated/java_engine.dart';
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 AnalysisResult lastResult = new AnalysisResult(null, 1, '', 1); 44 AnalysisResult lastResult = new AnalysisResult(null, 1, '', 1);
45 context.when(callsTo("performAnalysisTask")) 45 context.when(callsTo("performAnalysisTask"))
46 ..thenReturn(firstResult, 3) 46 ..thenReturn(firstResult, 3)
47 ..thenReturn(lastResult); 47 ..thenReturn(lastResult);
48 helper.server.schedulePerformAnalysisOperation(context); 48 helper.server.schedulePerformAnalysisOperation(context);
49 // Pump the event queue to make sure the server has finished any 49 // Pump the event queue to make sure the server has finished any
50 // analysis. 50 // analysis.
51 return pumpEventQueue().then((_) { 51 return pumpEventQueue().then((_) {
52 List<Notification> notifications = helper.channel.notificationsReceived; 52 List<Notification> notifications = helper.channel.notificationsReceived;
53 expect(notifications, isNot(isEmpty)); 53 expect(notifications, isNot(isEmpty));
54 // expect at least one notification indicating analysis is in progress
55 expect(notifications.any((Notification notification) {
56 if (notification.event == SERVER_STATUS) {
57 Map analysisStatus = notification.params['analysis'];
58 return analysisStatus['analyzing'];
59 }
60 return false;
61 }), isTrue);
62 // the last notification should indicate that analysis is complete
54 Notification notification = notifications[notifications.length - 1]; 63 Notification notification = notifications[notifications.length - 1];
55 Map analysisStatus = notification.params['analysis']; 64 Map analysisStatus = notification.params['analysis'];
56 expect(analysisStatus['analyzing'], isFalse); 65 expect(analysisStatus['analyzing'], isFalse);
57 }); 66 });
58 }); 67 });
59 68
60 test('echo', () { 69 test('echo', () {
61 AnalysisServerTestHelper helper = new AnalysisServerTestHelper(); 70 AnalysisServerTestHelper helper = new AnalysisServerTestHelper();
62 helper.server.handlers = [new EchoHandler()]; 71 helper.server.handlers = [new EchoHandler()];
63 var request = new Request('my22', 'echo'); 72 var request = new Request('my22', 'echo');
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 @override 119 @override
111 Response handleRequest(Request request) { 120 Response handleRequest(Request request) {
112 if (request.method == 'echo') { 121 if (request.method == 'echo') {
113 var response = new Response(request.id); 122 var response = new Response(request.id);
114 response.setResult('echo', true); 123 response.setResult('echo', true);
115 return response; 124 return response;
116 } 125 }
117 return null; 126 return null;
118 } 127 }
119 } 128 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698