| 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.domain.analysis; | 5 library test.domain.analysis; |
| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 MockServerChannel serverChannel; | 27 MockServerChannel serverChannel; |
| 28 MemoryResourceProvider resourceProvider; | 28 MemoryResourceProvider resourceProvider; |
| 29 AnalysisServer server; | 29 AnalysisServer server; |
| 30 AnalysisDomainHandler handler; | 30 AnalysisDomainHandler handler; |
| 31 | 31 |
| 32 setUp(() { | 32 setUp(() { |
| 33 serverChannel = new MockServerChannel(); | 33 serverChannel = new MockServerChannel(); |
| 34 resourceProvider = new MemoryResourceProvider(); | 34 resourceProvider = new MemoryResourceProvider(); |
| 35 server = new AnalysisServer( | 35 server = new AnalysisServer( |
| 36 serverChannel, resourceProvider, new MockPackageMapProvider()); | 36 serverChannel, resourceProvider, new MockPackageMapProvider(), null); |
| 37 server.defaultSdk = new MockSdk(); | 37 server.defaultSdk = new MockSdk(); |
| 38 handler = new AnalysisDomainHandler(server); | 38 handler = new AnalysisDomainHandler(server); |
| 39 }); | 39 }); |
| 40 | 40 |
| 41 group('notification.errors', testNotificationErrors); | 41 group('notification.errors', testNotificationErrors); |
| 42 group('updateContent', testUpdateContent); | 42 group('updateContent', testUpdateContent); |
| 43 group('setSubscriptions', test_setSubscriptions); | 43 group('setSubscriptions', test_setSubscriptions); |
| 44 | 44 |
| 45 group('AnalysisDomainHandler', () { | 45 group('AnalysisDomainHandler', () { |
| 46 group('setAnalysisRoots', () { | 46 group('setAnalysisRoots', () { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 Map<String, List<Map<String, Object>>> filesHighlights = {}; | 204 Map<String, List<Map<String, Object>>> filesHighlights = {}; |
| 205 Map<String, List<Map<String, Object>>> filesNavigation = {}; | 205 Map<String, List<Map<String, Object>>> filesNavigation = {}; |
| 206 | 206 |
| 207 String testFile = '/project/bin/test.dart'; | 207 String testFile = '/project/bin/test.dart'; |
| 208 String testCode; | 208 String testCode; |
| 209 | 209 |
| 210 AnalysisTestHelper() { | 210 AnalysisTestHelper() { |
| 211 serverChannel = new MockServerChannel(); | 211 serverChannel = new MockServerChannel(); |
| 212 resourceProvider = new MemoryResourceProvider(); | 212 resourceProvider = new MemoryResourceProvider(); |
| 213 server = new AnalysisServer( | 213 server = new AnalysisServer( |
| 214 serverChannel, resourceProvider, new MockPackageMapProvider()); | 214 serverChannel, resourceProvider, new MockPackageMapProvider(), null); |
| 215 server.defaultSdk = new MockSdk(); | 215 server.defaultSdk = new MockSdk(); |
| 216 handler = new AnalysisDomainHandler(server); | 216 handler = new AnalysisDomainHandler(server); |
| 217 // listen for notifications | 217 // listen for notifications |
| 218 Stream<Notification> notificationStream = serverChannel.notificationControll
er.stream; | 218 Stream<Notification> notificationStream = serverChannel.notificationControll
er.stream; |
| 219 notificationStream.listen((Notification notification) { | 219 notificationStream.listen((Notification notification) { |
| 220 if (notification.event == ANALYSIS_ERRORS) { | 220 if (notification.event == ANALYSIS_ERRORS) { |
| 221 String file = notification.getParameter(FILE); | 221 String file = notification.getParameter(FILE); |
| 222 List<Map<String, Object>> errorMaps = notification.getParameter(ERRORS); | 222 List<Map<String, Object>> errorMaps = notification.getParameter(ERRORS); |
| 223 filesErrors[file] = errorMaps.map(jsonToAnalysisError).toList(); | 223 filesErrors[file] = errorMaps.map(jsonToAnalysisError).toList(); |
| 224 } | 224 } |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 // create project and wait for analysis | 587 // create project and wait for analysis |
| 588 createProject(); | 588 createProject(); |
| 589 return waitForTasksFinished().then((_) { | 589 return waitForTasksFinished().then((_) { |
| 590 // if 'package:pkgA/libA.dart' was resolved, then there are no errors | 590 // if 'package:pkgA/libA.dart' was resolved, then there are no errors |
| 591 expect(filesErrors[testFile], isEmpty); | 591 expect(filesErrors[testFile], isEmpty); |
| 592 // packages file also was resolved | 592 // packages file also was resolved |
| 593 expect(filesErrors[pkgFile], isEmpty); | 593 expect(filesErrors[pkgFile], isEmpty); |
| 594 }); | 594 }); |
| 595 } | 595 } |
| 596 } | 596 } |
| OLD | NEW |