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/computer/computer_highlights.dart'; | 9 import 'package:analysis_server/src/computer/computer_highlights.dart'; |
10 import 'package:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
(...skipping 10 matching lines...) Expand all Loading... |
21 groupSep = ' | '; | 21 groupSep = ' | '; |
22 | 22 |
23 MockServerChannel serverChannel; | 23 MockServerChannel serverChannel; |
24 AnalysisServer server; | 24 AnalysisServer server; |
25 AnalysisDomainHandler handler; | 25 AnalysisDomainHandler handler; |
26 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); | 26 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); |
27 | 27 |
28 setUp(() { | 28 setUp(() { |
29 serverChannel = new MockServerChannel(); | 29 serverChannel = new MockServerChannel(); |
30 server = new AnalysisServer(serverChannel, resourceProvider); | 30 server = new AnalysisServer(serverChannel, resourceProvider); |
| 31 server.defaultSdk = new MockSdk(); |
31 handler = new AnalysisDomainHandler(server); | 32 handler = new AnalysisDomainHandler(server); |
32 }); | 33 }); |
33 | 34 |
34 group('notification.errors', testNotificationErrors); | 35 group('notification.errors', testNotificationErrors); |
35 group('notification.highlights', testNotificationHighlights); | 36 group('notification.highlights', testNotificationHighlights); |
36 group('notification.navigation', testNotificationNavigation); | 37 group('notification.navigation', testNotificationNavigation); |
37 group('updateContent', testUpdateContent); | 38 group('updateContent', testUpdateContent); |
38 group('setSubscriptions', test_setSubscriptions); | 39 group('setSubscriptions', test_setSubscriptions); |
39 | 40 |
40 group('AnalysisDomainHandler', () { | 41 group('AnalysisDomainHandler', () { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 Map<String, List<Map<String, Object>>> filesHighlights = {}; | 178 Map<String, List<Map<String, Object>>> filesHighlights = {}; |
178 Map<String, List<Map<String, Object>>> filesNavigation = {}; | 179 Map<String, List<Map<String, Object>>> filesNavigation = {}; |
179 | 180 |
180 String testFile = '/project/bin/test.dart'; | 181 String testFile = '/project/bin/test.dart'; |
181 String testCode; | 182 String testCode; |
182 | 183 |
183 AnalysisTestHelper() { | 184 AnalysisTestHelper() { |
184 serverChannel = new MockServerChannel(); | 185 serverChannel = new MockServerChannel(); |
185 resourceProvider = new MemoryResourceProvider(); | 186 resourceProvider = new MemoryResourceProvider(); |
186 server = new AnalysisServer(serverChannel, resourceProvider); | 187 server = new AnalysisServer(serverChannel, resourceProvider); |
| 188 server.defaultSdk = new MockSdk(); |
187 handler = new AnalysisDomainHandler(server); | 189 handler = new AnalysisDomainHandler(server); |
188 // listen for notifications | 190 // listen for notifications |
189 Stream<Notification> notificationStream = serverChannel.notificationControll
er.stream; | 191 Stream<Notification> notificationStream = serverChannel.notificationControll
er.stream; |
190 notificationStream.listen((Notification notification) { | 192 notificationStream.listen((Notification notification) { |
191 if (notification.event == NOTIFICATION_ERRORS) { | 193 if (notification.event == NOTIFICATION_ERRORS) { |
192 String file = notification.getParameter(FILE); | 194 String file = notification.getParameter(FILE); |
193 List<Map<String, Object>> errorMaps = notification.getParameter(ERRORS); | 195 List<Map<String, Object>> errorMaps = notification.getParameter(ERRORS); |
194 filesErrors[file] = errorMaps.map(jsonToAnalysisError).toList(); | 196 filesErrors[file] = errorMaps.map(jsonToAnalysisError).toList(); |
195 } | 197 } |
196 if (notification.event == NOTIFICATION_HIGHLIGHTS) { | 198 if (notification.event == NOTIFICATION_HIGHLIGHTS) { |
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 // subscribe | 1634 // subscribe |
1633 helper.addAnalysisSubscriptionHighlights(helper.testFile); | 1635 helper.addAnalysisSubscriptionHighlights(helper.testFile); |
1634 // wait, has regions | 1636 // wait, has regions |
1635 return helper.waitForOperationsFinished().then((_) { | 1637 return helper.waitForOperationsFinished().then((_) { |
1636 var highlights = helper.getHighlights(helper.testFile); | 1638 var highlights = helper.getHighlights(helper.testFile); |
1637 expect(highlights, isNot(isEmpty)); | 1639 expect(highlights, isNot(isEmpty)); |
1638 }); | 1640 }); |
1639 }); | 1641 }); |
1640 }); | 1642 }); |
1641 } | 1643 } |
OLD | NEW |