| 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/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
| 11 import 'package:analysis_server/src/constants.dart'; | 11 import 'package:analysis_server/src/constants.dart'; |
| 12 import 'package:analysis_server/src/domain_analysis.dart'; | 12 import 'package:analysis_server/src/domain_analysis.dart'; |
| 13 import 'package:analysis_server/src/plugin/server_plugin.dart'; | 13 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| 14 import 'package:analyzer/file_system/memory_file_system.dart'; | 14 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 15 import 'package:analyzer/instrumentation/instrumentation.dart'; | 15 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 16 import 'package:analyzer/src/generated/sdk.dart'; |
| 16 import 'package:path/path.dart'; | 17 import 'package:path/path.dart'; |
| 17 import 'package:plugin/manager.dart'; | 18 import 'package:plugin/manager.dart'; |
| 18 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 19 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 19 import 'package:unittest/unittest.dart'; | 20 import 'package:unittest/unittest.dart'; |
| 20 | 21 |
| 21 import 'analysis_abstract.dart'; | 22 import 'analysis_abstract.dart'; |
| 22 import 'mock_sdk.dart'; | 23 import 'mock_sdk.dart'; |
| 23 import 'mocks.dart'; | 24 import 'mocks.dart'; |
| 24 import 'utils.dart'; | 25 import 'utils.dart'; |
| 25 | 26 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 40 ExtensionManager manager = new ExtensionManager(); | 41 ExtensionManager manager = new ExtensionManager(); |
| 41 ServerPlugin serverPlugin = new ServerPlugin(); | 42 ServerPlugin serverPlugin = new ServerPlugin(); |
| 42 manager.processPlugins([serverPlugin]); | 43 manager.processPlugins([serverPlugin]); |
| 43 server = new AnalysisServer( | 44 server = new AnalysisServer( |
| 44 serverChannel, | 45 serverChannel, |
| 45 resourceProvider, | 46 resourceProvider, |
| 46 new MockPackageMapProvider(), | 47 new MockPackageMapProvider(), |
| 47 null, | 48 null, |
| 48 serverPlugin, | 49 serverPlugin, |
| 49 new AnalysisServerOptions(), | 50 new AnalysisServerOptions(), |
| 50 (_) => new MockSdk(), | 51 new DartSdkManager('', false, (_) => new MockSdk()), |
| 51 InstrumentationService.NULL_SERVICE); | 52 InstrumentationService.NULL_SERVICE); |
| 52 handler = new AnalysisDomainHandler(server); | 53 handler = new AnalysisDomainHandler(server); |
| 53 }); | 54 }); |
| 54 | 55 |
| 55 group('updateContent', testUpdateContent); | 56 group('updateContent', testUpdateContent); |
| 56 | 57 |
| 57 group('AnalysisDomainHandler', () { | 58 group('AnalysisDomainHandler', () { |
| 58 group('getReachableSources', () { | 59 group('getReachableSources', () { |
| 59 test('valid sources', () async { | 60 test('valid sources', () async { |
| 60 String fileA = '/project/a.dart'; | 61 String fileA = '/project/a.dart'; |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 ExtensionManager manager = new ExtensionManager(); | 468 ExtensionManager manager = new ExtensionManager(); |
| 468 ServerPlugin serverPlugin = new ServerPlugin(); | 469 ServerPlugin serverPlugin = new ServerPlugin(); |
| 469 manager.processPlugins([serverPlugin]); | 470 manager.processPlugins([serverPlugin]); |
| 470 server = new AnalysisServer( | 471 server = new AnalysisServer( |
| 471 serverChannel, | 472 serverChannel, |
| 472 resourceProvider, | 473 resourceProvider, |
| 473 new MockPackageMapProvider(), | 474 new MockPackageMapProvider(), |
| 474 null, | 475 null, |
| 475 serverPlugin, | 476 serverPlugin, |
| 476 new AnalysisServerOptions(), | 477 new AnalysisServerOptions(), |
| 477 (_) => new MockSdk(), | 478 new DartSdkManager('', false, (_) => new MockSdk()), |
| 478 InstrumentationService.NULL_SERVICE); | 479 InstrumentationService.NULL_SERVICE); |
| 479 handler = new AnalysisDomainHandler(server); | 480 handler = new AnalysisDomainHandler(server); |
| 480 // listen for notifications | 481 // listen for notifications |
| 481 Stream<Notification> notificationStream = | 482 Stream<Notification> notificationStream = |
| 482 serverChannel.notificationController.stream; | 483 serverChannel.notificationController.stream; |
| 483 notificationStream.listen((Notification notification) { | 484 notificationStream.listen((Notification notification) { |
| 484 if (notification.event == ANALYSIS_ERRORS) { | 485 if (notification.event == ANALYSIS_ERRORS) { |
| 485 var decoded = new AnalysisErrorsParams.fromNotification(notification); | 486 var decoded = new AnalysisErrorsParams.fromNotification(notification); |
| 486 filesErrors[decoded.file] = decoded.errors; | 487 filesErrors[decoded.file] = decoded.errors; |
| 487 } | 488 } |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 test_beforeAnalysis() async { | 809 test_beforeAnalysis() async { |
| 809 addTestFile('int V = 42;'); | 810 addTestFile('int V = 42;'); |
| 810 createProject(); | 811 createProject(); |
| 811 // subscribe | 812 // subscribe |
| 812 addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile); | 813 addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile); |
| 813 // wait for analysis | 814 // wait for analysis |
| 814 await waitForTasksFinished(); | 815 await waitForTasksFinished(); |
| 815 expect(filesHighlights[testFile], isNotEmpty); | 816 expect(filesHighlights[testFile], isNotEmpty); |
| 816 } | 817 } |
| 817 } | 818 } |
| OLD | NEW |