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

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

Issue 1159623013: Fix more tests for the new task model (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/domain_analysis_test.dart » ('j') | 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 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 server.serverServices = [ServerService.STATUS].toSet(); 201 server.serverServices = [ServerService.STATUS].toSet();
202 // Analyze project foo containing foo.dart and project bar containing 202 // Analyze project foo containing foo.dart and project bar containing
203 // bar.dart. 203 // bar.dart.
204 resourceProvider.newFolder('/foo'); 204 resourceProvider.newFolder('/foo');
205 resourceProvider.newFolder('/bar'); 205 resourceProvider.newFolder('/bar');
206 File foo = resourceProvider.newFile('/foo/foo.dart', 'library lib;'); 206 File foo = resourceProvider.newFile('/foo/foo.dart', 'library lib;');
207 Source fooSource = foo.createSource(); 207 Source fooSource = foo.createSource();
208 File bar = resourceProvider.newFile('/bar/bar.dart', 'library lib;'); 208 File bar = resourceProvider.newFile('/bar/bar.dart', 'library lib;');
209 Source barSource = bar.createSource(); 209 Source barSource = bar.createSource();
210 server.setAnalysisRoots('0', ['/foo', '/bar'], [], {}); 210 server.setAnalysisRoots('0', ['/foo', '/bar'], [], {});
211 return pumpEventQueue(50).then((_) { 211 return pumpEventQueue(200).then((_) {
212 expect(server.statusAnalyzing, isFalse); 212 expect(server.statusAnalyzing, isFalse);
213 // Make sure getAnalysisContext returns the proper context for each. 213 // Make sure getAnalysisContext returns the proper context for each.
214 AnalysisContext fooContext = 214 AnalysisContext fooContext =
215 server.getAnalysisContextForSource(fooSource); 215 server.getAnalysisContextForSource(fooSource);
216 expect(fooContext, isNotNull); 216 expect(fooContext, isNotNull);
217 AnalysisContext barContext = 217 AnalysisContext barContext =
218 server.getAnalysisContextForSource(barSource); 218 server.getAnalysisContextForSource(barSource);
219 expect(barContext, isNotNull); 219 expect(barContext, isNotNull);
220 expect(fooContext, isNot(same(barContext))); 220 expect(fooContext, isNot(same(barContext)));
221 expect(fooContext.getKindOf(fooSource), SourceKind.LIBRARY); 221 expect(fooContext.getKindOf(fooSource), SourceKind.LIBRARY);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 resourceProvider.newFolder('/bar'); 313 resourceProvider.newFolder('/bar');
314 resourceProvider.newFile('/foo/foo.dart', 'import "../bar/bar.dart";'); 314 resourceProvider.newFile('/foo/foo.dart', 'import "../bar/bar.dart";');
315 File bar = resourceProvider.newFile('/bar/bar.dart', 'library bar;'); 315 File bar = resourceProvider.newFile('/bar/bar.dart', 'library bar;');
316 server.setAnalysisRoots('0', ['/foo', '/bar'], [], {}); 316 server.setAnalysisRoots('0', ['/foo', '/bar'], [], {});
317 Map<AnalysisService, Set<String>> subscriptions = 317 Map<AnalysisService, Set<String>> subscriptions =
318 <AnalysisService, Set<String>>{}; 318 <AnalysisService, Set<String>>{};
319 for (AnalysisService service in AnalysisService.VALUES) { 319 for (AnalysisService service in AnalysisService.VALUES) {
320 subscriptions[service] = <String>[bar.path].toSet(); 320 subscriptions[service] = <String>[bar.path].toSet();
321 } 321 }
322 server.setAnalysisSubscriptions(subscriptions); 322 server.setAnalysisSubscriptions(subscriptions);
323 await pumpEventQueue(100); 323 await pumpEventQueue(200);
324 expect(server.statusAnalyzing, isFalse); 324 expect(server.statusAnalyzing, isFalse);
325 channel.notificationsReceived.clear(); 325 channel.notificationsReceived.clear();
326 server.updateContent( 326 server.updateContent(
327 '0', {bar.path: new AddContentOverlay('library bar; void f() {}')}); 327 '0', {bar.path: new AddContentOverlay('library bar; void f() {}')});
328 await pumpEventQueue(100); 328 await pumpEventQueue(200);
329 expect(server.statusAnalyzing, isFalse); 329 expect(server.statusAnalyzing, isFalse);
330 expect(channel.notificationsReceived, isNotEmpty); 330 expect(channel.notificationsReceived, isNotEmpty);
331 Set<String> notificationTypesReceived = new Set<String>(); 331 Set<String> notificationTypesReceived = new Set<String>();
332 for (Notification notification in channel.notificationsReceived) { 332 for (Notification notification in channel.notificationsReceived) {
333 String notificationType = notification.event; 333 String notificationType = notification.event;
334 switch (notificationType) { 334 switch (notificationType) {
335 case 'server.status': 335 case 'server.status':
336 case 'analysis.errors': 336 case 'analysis.errors':
337 // It's normal for these notifications to be sent multiple times. 337 // It's normal for these notifications to be sent multiple times.
338 break; 338 break;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 _MockServerOperation(this.context); 500 _MockServerOperation(this.context);
501 501
502 @override 502 @override
503 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS; 503 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS;
504 504
505 @override 505 @override
506 void perform(AnalysisServer server) { 506 void perform(AnalysisServer server) {
507 isComplete = true; 507 isComplete = true;
508 } 508 }
509 } 509 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/domain_analysis_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698