| 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/computer/element.dart'; | 10 import 'package:analysis_server/src/computer/element.dart'; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 MockServerChannel serverChannel; | 41 MockServerChannel serverChannel; |
| 42 MemoryResourceProvider resourceProvider; | 42 MemoryResourceProvider resourceProvider; |
| 43 AnalysisServer server; | 43 AnalysisServer server; |
| 44 AnalysisDomainHandler handler; | 44 AnalysisDomainHandler handler; |
| 45 | 45 |
| 46 setUp(() { | 46 setUp(() { |
| 47 serverChannel = new MockServerChannel(); | 47 serverChannel = new MockServerChannel(); |
| 48 resourceProvider = new MemoryResourceProvider(); | 48 resourceProvider = new MemoryResourceProvider(); |
| 49 server = new AnalysisServer(serverChannel, resourceProvider, | 49 server = new AnalysisServer(serverChannel, resourceProvider, |
| 50 new MockPackageMapProvider(), null); | 50 new MockPackageMapProvider(), null, new MockSdk()); |
| 51 server.defaultSdk = new MockSdk(); | |
| 52 handler = new AnalysisDomainHandler(server); | 51 handler = new AnalysisDomainHandler(server); |
| 53 }); | 52 }); |
| 54 | 53 |
| 55 group('notification.errors', testNotificationErrors); | 54 group('notification.errors', testNotificationErrors); |
| 56 group('updateContent', testUpdateContent); | 55 group('updateContent', testUpdateContent); |
| 57 group('setSubscriptions', test_setSubscriptions); | 56 group('setSubscriptions', test_setSubscriptions); |
| 58 | 57 |
| 59 group('AnalysisDomainHandler', () { | 58 group('AnalysisDomainHandler', () { |
| 60 group('setAnalysisRoots', () { | 59 group('setAnalysisRoots', () { |
| 61 Request request; | 60 Request request; |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 Map<String, List<Map<String, Object>>> filesHighlights = {}; | 453 Map<String, List<Map<String, Object>>> filesHighlights = {}; |
| 455 Map<String, List<Map<String, Object>>> filesNavigation = {}; | 454 Map<String, List<Map<String, Object>>> filesNavigation = {}; |
| 456 | 455 |
| 457 String testFile = '/project/bin/test.dart'; | 456 String testFile = '/project/bin/test.dart'; |
| 458 String testCode; | 457 String testCode; |
| 459 | 458 |
| 460 AnalysisTestHelper() { | 459 AnalysisTestHelper() { |
| 461 serverChannel = new MockServerChannel(); | 460 serverChannel = new MockServerChannel(); |
| 462 resourceProvider = new MemoryResourceProvider(); | 461 resourceProvider = new MemoryResourceProvider(); |
| 463 server = new AnalysisServer(serverChannel, resourceProvider, | 462 server = new AnalysisServer(serverChannel, resourceProvider, |
| 464 new MockPackageMapProvider(), null); | 463 new MockPackageMapProvider(), null, new MockSdk()); |
| 465 server.defaultSdk = new MockSdk(); | |
| 466 handler = new AnalysisDomainHandler(server); | 464 handler = new AnalysisDomainHandler(server); |
| 467 // listen for notifications | 465 // listen for notifications |
| 468 Stream<Notification> notificationStream = | 466 Stream<Notification> notificationStream = |
| 469 serverChannel.notificationController.stream; | 467 serverChannel.notificationController.stream; |
| 470 notificationStream.listen((Notification notification) { | 468 notificationStream.listen((Notification notification) { |
| 471 if (notification.event == ANALYSIS_ERRORS) { | 469 if (notification.event == ANALYSIS_ERRORS) { |
| 472 String file = notification.getParameter(FILE); | 470 String file = notification.getParameter(FILE); |
| 473 List<Map<String, Object>> errorMaps = notification.getParameter(ERRORS); | 471 List<Map<String, Object>> errorMaps = notification.getParameter(ERRORS); |
| 474 filesErrors[file] = errorMaps.map(jsonToAnalysisError).toList(); | 472 filesErrors[file] = errorMaps.map(jsonToAnalysisError).toList(); |
| 475 } | 473 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 return waitForServerOperationsPerformed(server); | 642 return waitForServerOperationsPerformed(server); |
| 645 } | 643 } |
| 646 | 644 |
| 647 static String _getCodeString(code) { | 645 static String _getCodeString(code) { |
| 648 if (code is List<String>) { | 646 if (code is List<String>) { |
| 649 code = code.join('\n'); | 647 code = code.join('\n'); |
| 650 } | 648 } |
| 651 return code as String; | 649 return code as String; |
| 652 } | 650 } |
| 653 } | 651 } |
| OLD | NEW |