OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 'package:analysis_server/protocol/protocol.dart'; | 5 import 'package:analysis_server/protocol/protocol.dart'; |
6 import 'package:analysis_server/protocol/protocol_constants.dart'; | 6 import 'package:analysis_server/protocol/protocol_constants.dart'; |
7 import 'package:analysis_server/protocol/protocol_generated.dart'; | 7 import 'package:analysis_server/protocol/protocol_generated.dart'; |
8 import 'package:analyzer/dart/ast/ast.dart'; | |
9 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | |
10 import 'package:analyzer/file_system/file_system.dart'; | 8 import 'package:analyzer/file_system/file_system.dart'; |
11 import 'package:analyzer/src/dart/analysis/driver.dart'; | 9 import 'package:analyzer/src/dart/analysis/driver.dart'; |
12 import 'package:analyzer_plugin/protocol/protocol_common.dart' as plugin; | 10 import 'package:analyzer_plugin/protocol/protocol_common.dart' as plugin; |
13 import 'package:analyzer_plugin/protocol/protocol_common.dart'; | 11 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
14 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; | 12 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; |
15 import 'package:test/test.dart'; | 13 import 'package:test/test.dart'; |
16 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 14 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
17 import 'package:typed_mock/typed_mock.dart'; | |
18 | 15 |
19 import '../analysis_abstract.dart'; | 16 import '../analysis_abstract.dart'; |
20 | 17 |
21 main() { | 18 main() { |
22 defineReflectiveSuite(() { | 19 defineReflectiveSuite(() { |
23 defineReflectiveTests(UpdateContentTest); | 20 defineReflectiveTests(UpdateContentTest); |
24 }); | 21 }); |
25 } | 22 } |
26 | 23 |
27 compilationUnitMatcher(String file) { | |
28 return new _ArgumentMatcher_CompilationUnit(file); | |
29 } | |
30 | |
31 @reflectiveTest | 24 @reflectiveTest |
32 class UpdateContentTest extends AbstractAnalysisTest { | 25 class UpdateContentTest extends AbstractAnalysisTest { |
33 Map<String, List<String>> filesErrors = {}; | 26 Map<String, List<String>> filesErrors = {}; |
34 int serverErrorCount = 0; | 27 int serverErrorCount = 0; |
35 int navigationCount = 0; | 28 int navigationCount = 0; |
36 | 29 |
37 @override | 30 @override |
38 void processNotification(Notification notification) { | 31 void processNotification(Notification notification) { |
39 if (notification.event == ANALYSIS_NOTIFICATION_ERRORS) { | 32 if (notification.event == ANALYSIS_NOTIFICATION_ERRORS) { |
40 var decoded = new AnalysisErrorsParams.fromNotification(notification); | 33 var decoded = new AnalysisErrorsParams.fromNotification(notification); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 List<String> _getUserSources(AnalysisDriver driver) { | 257 List<String> _getUserSources(AnalysisDriver driver) { |
265 List<String> sources = <String>[]; | 258 List<String> sources = <String>[]; |
266 driver.addedFiles.forEach((path) { | 259 driver.addedFiles.forEach((path) { |
267 if (path.startsWith('/User/')) { | 260 if (path.startsWith('/User/')) { |
268 sources.add(path); | 261 sources.add(path); |
269 } | 262 } |
270 }); | 263 }); |
271 return sources; | 264 return sources; |
272 } | 265 } |
273 } | 266 } |
274 | |
275 class _ArgumentMatcher_CompilationUnit extends ArgumentMatcher { | |
276 final String file; | |
277 | |
278 _ArgumentMatcher_CompilationUnit(this.file); | |
279 | |
280 @override | |
281 bool matches(arg) { | |
282 return arg is CompilationUnit && | |
283 resolutionMap.elementDeclaredByCompilationUnit(arg).source.fullName == | |
284 file; | |
285 } | |
286 } | |
OLD | NEW |