| 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:analysis_server/src/services/index/index.dart'; | |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 9 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| 11 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| 12 import 'package:analyzer/src/dart/analysis/driver.dart'; | 11 import 'package:analyzer/src/dart/analysis/driver.dart'; |
| 13 import 'package:analyzer_plugin/protocol/protocol_common.dart' as plugin; | 12 import 'package:analyzer_plugin/protocol/protocol_common.dart' as plugin; |
| 14 import 'package:analyzer_plugin/protocol/protocol_common.dart'; | 13 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
| 15 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; | 14 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; |
| 16 import 'package:test/test.dart'; | 15 import 'package:test/test.dart'; |
| 17 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 16 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 18 import 'package:typed_mock/typed_mock.dart'; | 17 import 'package:typed_mock/typed_mock.dart'; |
| 19 | 18 |
| 20 import '../analysis_abstract.dart'; | 19 import '../analysis_abstract.dart'; |
| 21 | 20 |
| 22 main() { | 21 main() { |
| 23 defineReflectiveSuite(() { | 22 defineReflectiveSuite(() { |
| 24 defineReflectiveTests(UpdateContentTest); | 23 defineReflectiveTests(UpdateContentTest); |
| 25 }); | 24 }); |
| 26 } | 25 } |
| 27 | 26 |
| 28 compilationUnitMatcher(String file) { | 27 compilationUnitMatcher(String file) { |
| 29 return new _ArgumentMatcher_CompilationUnit(file); | 28 return new _ArgumentMatcher_CompilationUnit(file); |
| 30 } | 29 } |
| 31 | 30 |
| 32 @reflectiveTest | 31 @reflectiveTest |
| 33 class UpdateContentTest extends AbstractAnalysisTest { | 32 class UpdateContentTest extends AbstractAnalysisTest { |
| 34 Map<String, List<String>> filesErrors = {}; | 33 Map<String, List<String>> filesErrors = {}; |
| 35 int serverErrorCount = 0; | 34 int serverErrorCount = 0; |
| 36 int navigationCount = 0; | 35 int navigationCount = 0; |
| 37 | 36 |
| 38 Index createIndex() { | |
| 39 return new _MockIndex(); | |
| 40 } | |
| 41 | |
| 42 @override | 37 @override |
| 43 void processNotification(Notification notification) { | 38 void processNotification(Notification notification) { |
| 44 if (notification.event == ANALYSIS_NOTIFICATION_ERRORS) { | 39 if (notification.event == ANALYSIS_NOTIFICATION_ERRORS) { |
| 45 var decoded = new AnalysisErrorsParams.fromNotification(notification); | 40 var decoded = new AnalysisErrorsParams.fromNotification(notification); |
| 46 String _format(AnalysisError e) => | 41 String _format(AnalysisError e) => |
| 47 "${e.location.startLine}: ${e.message}"; | 42 "${e.location.startLine}: ${e.message}"; |
| 48 filesErrors[decoded.file] = decoded.errors.map(_format).toList(); | 43 filesErrors[decoded.file] = decoded.errors.map(_format).toList(); |
| 49 } | 44 } |
| 50 if (notification.event == ANALYSIS_NOTIFICATION_NAVIGATION) { | 45 if (notification.event == ANALYSIS_NOTIFICATION_NAVIGATION) { |
| 51 navigationCount++; | 46 navigationCount++; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 303 |
| 309 _ArgumentMatcher_CompilationUnit(this.file); | 304 _ArgumentMatcher_CompilationUnit(this.file); |
| 310 | 305 |
| 311 @override | 306 @override |
| 312 bool matches(arg) { | 307 bool matches(arg) { |
| 313 return arg is CompilationUnit && | 308 return arg is CompilationUnit && |
| 314 resolutionMap.elementDeclaredByCompilationUnit(arg).source.fullName == | 309 resolutionMap.elementDeclaredByCompilationUnit(arg).source.fullName == |
| 315 file; | 310 file; |
| 316 } | 311 } |
| 317 } | 312 } |
| 318 | |
| 319 class _MockIndex extends TypedMock implements Index {} | |
| OLD | NEW |