| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 server.updateContent( | 100 server.updateContent( |
| 101 '1', {testFile: new AddContentOverlay('main() { print(2); }')}); | 101 '1', {testFile: new AddContentOverlay('main() { print(2); }')}); |
| 102 // Perform the next single operation: analysis. | 102 // Perform the next single operation: analysis. |
| 103 // It will schedule an indexing operation. | 103 // It will schedule an indexing operation. |
| 104 await server.test_onOperationPerformed; | 104 await server.test_onOperationPerformed; |
| 105 // Update the file and remove an overlay. | 105 // Update the file and remove an overlay. |
| 106 resourceProvider.updateFile(testFile, 'main() { print(2); }'); | 106 resourceProvider.updateFile(testFile, 'main() { print(2); }'); |
| 107 server.updateContent('2', {testFile: new RemoveContentOverlay()}); | 107 server.updateContent('2', {testFile: new RemoveContentOverlay()}); |
| 108 // Validate that at the end the unit was indexed. | 108 // Validate that at the end the unit was indexed. |
| 109 await server.onAnalysisComplete; | 109 await server.onAnalysisComplete; |
| 110 verify(server.index.index(anyObject, testUnitMatcher)).times(2); | 110 if (AnalysisEngine.instance.useTaskModel) { |
| 111 verify(server.index.index(anyObject, testUnitMatcher)).times(3); |
| 112 } else { |
| 113 verify(server.index.index(anyObject, testUnitMatcher)).times(2); |
| 114 } |
| 111 } | 115 } |
| 112 | 116 |
| 113 test_multiple_contexts() async { | 117 test_multiple_contexts() async { |
| 114 String fooPath = '/project1/foo.dart'; | 118 String fooPath = '/project1/foo.dart'; |
| 115 resourceProvider.newFile( | 119 resourceProvider.newFile( |
| 116 fooPath, | 120 fooPath, |
| 117 ''' | 121 ''' |
| 118 library foo; | 122 library foo; |
| 119 import '../project2/baz.dart'; | 123 import '../project2/baz.dart'; |
| 120 main() { f(); }'''); | 124 main() { f(); }'''); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 270 |
| 267 @override | 271 @override |
| 268 bool matches(arg) { | 272 bool matches(arg) { |
| 269 return arg is CompilationUnit && arg.element.source.fullName == file; | 273 return arg is CompilationUnit && arg.element.source.fullName == file; |
| 270 } | 274 } |
| 271 } | 275 } |
| 272 | 276 |
| 273 class _MockIndex extends TypedMock implements Index { | 277 class _MockIndex extends TypedMock implements Index { |
| 274 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 278 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 275 } | 279 } |
| OLD | NEW |