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

Unified Diff: pkg/analysis_server/test/analysis_server_test.dart

Issue 303233007: First cut at server timing tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed some bugs, added tests Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 45c97efae5e468fa2d4002a7a8bc3f2eb7da1b76..a73b6a13bf56d0fc0b5fbf34842f9ea11af2dcde 100644
--- a/pkg/analysis_server/test/analysis_server_test.dart
+++ b/pkg/analysis_server/test/analysis_server_test.dart
@@ -8,6 +8,7 @@ import 'dart:async';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/error.dart';
+import 'package:analyzer/src/generated/source.dart';
import 'package:analysis_server/src/analysis_server.dart';
import 'package:analysis_server/src/constants.dart';
import 'package:analysis_server/src/domain_server.dart';
@@ -43,6 +44,31 @@ main() {
return pumpEventQueue();
});
+ test('server.status notifications', () {
+ AnalysisServerTestHelper helper = new AnalysisServerTestHelper();
+ MockAnalysisContext context = new MockAnalysisContext();
+ MockSource source = new MockSource();
+ source.when(callsTo('get fullName')).alwaysReturn('foo.dart');
+ source.when(callsTo('get isInSystemLibrary')).alwaysReturn(false);
+ ChangeNoticeImpl notice = new ChangeNoticeImpl(source);
+ notice.setErrors([], new LineInfo([0]));
+ AnalysisResult firstResult = new AnalysisResult([notice], 0, '', 0);
+ AnalysisResult lastResult = new AnalysisResult(null, 1, '', 1);
+ context.when(callsTo("performAnalysisTask"))
+ ..thenReturn(firstResult, 3)
+ ..thenReturn(lastResult);
+ helper.server.addContextToWorkQueue(context);
+ // Pump the event queue to make sure the server has finished any
+ // analysis.
+ return pumpEventQueue().then((_) {
+ List<Notification> notifications = helper.channel.notificationsReceived;
+ expect(notifications.length, equals(9));
+ Notification notification = notifications[notifications.length - 1];
+ Map analysisStatus = notification.params['analysis'];
+ expect(analysisStatus['analyzing'], isFalse);
+ });
+ });
+
test('echo', () {
AnalysisServerTestHelper helper = new AnalysisServerTestHelper();
helper.server.handlers = [new EchoHandler()];
@@ -63,7 +89,7 @@ main() {
Map<String, Object> json = AnalysisServer.errorToJson(analysisError);
expect(json['message'],
- equals("The name 'foo' is defined in the libraries 'bar' and 'baz'"));
+ equals("The element 'foo' is defined in the libraries 'bar' and 'baz'"));
});
test('errorToJson_noCorrection', () {
« 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