| 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 library test.analysis.updateContent; | 5 library test.analysis.updateContent; |
| 6 | 6 |
| 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/src/analysis_server.dart'; | 8 import 'package:analysis_server/src/analysis_server.dart'; |
| 9 import 'package:analysis_server/src/constants.dart'; | 9 import 'package:analysis_server/src/constants.dart'; |
| 10 import 'package:analysis_server/src/services/index/index.dart'; | 10 import 'package:analysis_server/src/services/index/index.dart'; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 initializeTestEnvironment(); | 23 initializeTestEnvironment(); |
| 24 defineReflectiveTests(UpdateContentTest); | 24 defineReflectiveTests(UpdateContentTest); |
| 25 } | 25 } |
| 26 | 26 |
| 27 compilationUnitMatcher(String file) { | 27 compilationUnitMatcher(String file) { |
| 28 return new _ArgumentMatcher_CompilationUnit(file); | 28 return new _ArgumentMatcher_CompilationUnit(file); |
| 29 } | 29 } |
| 30 | 30 |
| 31 @reflectiveTest | 31 @reflectiveTest |
| 32 class UpdateContentTest extends AbstractAnalysisTest { | 32 class UpdateContentTest extends AbstractAnalysisTest { |
| 33 Map<String, List<AnalysisError>> filesErrors = {}; | 33 Map<String, List<String>> filesErrors = {}; |
| 34 int serverErrorCount = 0; | 34 int serverErrorCount = 0; |
| 35 int navigationCount = 0; | 35 int navigationCount = 0; |
| 36 | 36 |
| 37 Index createIndex() { | 37 Index createIndex() { |
| 38 return new _MockIndex(); | 38 return new _MockIndex(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 @override | 41 @override |
| 42 void processNotification(Notification notification) { | 42 void processNotification(Notification notification) { |
| 43 if (notification.event == ANALYSIS_ERRORS) { | 43 if (notification.event == ANALYSIS_ERRORS) { |
| 44 var decoded = new AnalysisErrorsParams.fromNotification(notification); | 44 var decoded = new AnalysisErrorsParams.fromNotification(notification); |
| 45 _format(AnalysisError e) => "${e.location.startLine}: ${e.message}"; | 45 String _format(AnalysisError e) => |
| 46 "${e.location.startLine}: ${e.message}"; |
| 46 filesErrors[decoded.file] = decoded.errors.map(_format).toList(); | 47 filesErrors[decoded.file] = decoded.errors.map(_format).toList(); |
| 47 } | 48 } |
| 48 if (notification.event == ANALYSIS_NAVIGATION) { | 49 if (notification.event == ANALYSIS_NAVIGATION) { |
| 49 navigationCount++; | 50 navigationCount++; |
| 50 } | 51 } |
| 51 if (notification.event == SERVER_ERROR) { | 52 if (notification.event == SERVER_ERROR) { |
| 52 serverErrorCount++; | 53 serverErrorCount++; |
| 53 } | 54 } |
| 54 } | 55 } |
| 55 | 56 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 291 |
| 291 _ArgumentMatcher_CompilationUnit(this.file); | 292 _ArgumentMatcher_CompilationUnit(this.file); |
| 292 | 293 |
| 293 @override | 294 @override |
| 294 bool matches(arg) { | 295 bool matches(arg) { |
| 295 return arg is CompilationUnit && arg.element.source.fullName == file; | 296 return arg is CompilationUnit && arg.element.source.fullName == file; |
| 296 } | 297 } |
| 297 } | 298 } |
| 298 | 299 |
| 299 class _MockIndex extends TypedMock implements Index {} | 300 class _MockIndex extends TypedMock implements Index {} |
| OLD | NEW |