OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analyzer/file_system/file_system.dart'; | 7 import 'package:analyzer/file_system/file_system.dart'; |
8 import 'package:analyzer/file_system/memory_file_system.dart'; | 8 import 'package:analyzer/file_system/memory_file_system.dart'; |
9 import 'package:analyzer/src/dart/analysis/driver.dart'; | 9 import 'package:analyzer/src/dart/analysis/driver.dart'; |
10 import 'package:analyzer_plugin/plugin/navigation_mixin.dart'; | 10 import 'package:analyzer_plugin/plugin/navigation_mixin.dart'; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 expect(result, isNotNull); | 57 expect(result, isNotNull); |
58 expect(result.files, hasLength(1)); | 58 expect(result.files, hasLength(1)); |
59 expect(result.targets, hasLength(1)); | 59 expect(result.targets, hasLength(1)); |
60 expect(result.regions, hasLength(2)); | 60 expect(result.regions, hasLength(2)); |
61 } | 61 } |
62 | 62 |
63 test_sendNavigationNotification() async { | 63 test_sendNavigationNotification() async { |
64 await plugin.handleAnalysisSetContextRoots( | 64 await plugin.handleAnalysisSetContextRoots( |
65 new AnalysisSetContextRootsParams([contextRoot1])); | 65 new AnalysisSetContextRootsParams([contextRoot1])); |
66 | 66 |
67 plugin.mockChannel.listen(null, | 67 channel.listen(null, onNotification: (Notification notification) { |
68 onNotification: (Notification notification) { | |
69 expect(notification, isNotNull); | 68 expect(notification, isNotNull); |
70 AnalysisNavigationParams params = | 69 AnalysisNavigationParams params = |
71 new AnalysisNavigationParams.fromNotification(notification); | 70 new AnalysisNavigationParams.fromNotification(notification); |
72 expect(params.files, hasLength(1)); | 71 expect(params.files, hasLength(1)); |
73 expect(params.targets, hasLength(1)); | 72 expect(params.targets, hasLength(1)); |
74 expect(params.regions, hasLength(2)); | 73 expect(params.regions, hasLength(2)); |
75 }); | 74 }); |
76 await plugin.sendNavigationNotification(filePath1); | 75 await plugin.sendNavigationNotification(filePath1); |
77 } | 76 } |
78 } | 77 } |
(...skipping 27 matching lines...) Expand all Loading... |
106 | 105 |
107 @override | 106 @override |
108 Future<NavigationRequest> getNavigationRequest( | 107 Future<NavigationRequest> getNavigationRequest( |
109 AnalysisGetNavigationParams parameters) async { | 108 AnalysisGetNavigationParams parameters) async { |
110 AnalysisResult result = new AnalysisResult(null, null, parameters.file, | 109 AnalysisResult result = new AnalysisResult(null, null, parameters.file, |
111 null, null, null, null, null, null, null, null); | 110 null, null, null, null, null, null, null, null); |
112 return new DartNavigationRequestImpl( | 111 return new DartNavigationRequestImpl( |
113 resourceProvider, parameters.offset, parameters.length, result); | 112 resourceProvider, parameters.offset, parameters.length, result); |
114 } | 113 } |
115 } | 114 } |
OLD | NEW |