| 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 analyzer.test.src.task.dart_work_manager_test; | 5 library analyzer.test.src.task.dart_work_manager_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/error/error.dart' show AnalysisError; | 8 import 'package:analyzer/error/error.dart' show AnalysisError; |
| 9 import 'package:analyzer/exception/exception.dart'; | 9 import 'package:analyzer/exception/exception.dart'; |
| 10 import 'package:analyzer/src/context/cache.dart'; | 10 import 'package:analyzer/src/context/cache.dart'; |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 void test_getLibrariesContainingPart_askResultProvider() { | 350 void test_getLibrariesContainingPart_askResultProvider() { |
| 351 Source part1 = new TestSource('part1.dart'); | 351 Source part1 = new TestSource('part1.dart'); |
| 352 Source part2 = new TestSource('part2.dart'); | 352 Source part2 = new TestSource('part2.dart'); |
| 353 Source part3 = new TestSource('part3.dart'); | 353 Source part3 = new TestSource('part3.dart'); |
| 354 Source library1 = new TestSource('library1.dart'); | 354 Source library1 = new TestSource('library1.dart'); |
| 355 Source library2 = new TestSource('library2.dart'); | 355 Source library2 = new TestSource('library2.dart'); |
| 356 // configure AnalysisContext mock | 356 // configure AnalysisContext mock |
| 357 when(context.aboutToComputeResult(anyObject, CONTAINING_LIBRARIES)) | 357 when(context.aboutToComputeResult(anyObject, CONTAINING_LIBRARIES)) |
| 358 .thenInvoke((CacheEntry entry, ResultDescriptor result) { | 358 .thenInvoke((CacheEntry entry, ResultDescriptor result) { |
| 359 if (entry.target == part1) { | 359 if (entry.target == part1) { |
| 360 entry.setValue(result, <Source>[library1, library2], []); | 360 entry.setValue(result as ResultDescriptor<List<Source>>, |
| 361 <Source>[library1, library2], []); |
| 361 return true; | 362 return true; |
| 362 } | 363 } |
| 363 if (entry.target == part2) { | 364 if (entry.target == part2) { |
| 364 entry.setValue(result, <Source>[library2], []); | 365 entry.setValue( |
| 366 result as ResultDescriptor<List<Source>>, <Source>[library2], []); |
| 365 return true; | 367 return true; |
| 366 } | 368 } |
| 367 return false; | 369 return false; |
| 368 }); | 370 }); |
| 369 // getLibrariesContainingPart | 371 // getLibrariesContainingPart |
| 370 expect(manager.getLibrariesContainingPart(part1), | 372 expect(manager.getLibrariesContainingPart(part1), |
| 371 unorderedEquals([library1, library2])); | 373 unorderedEquals([library1, library2])); |
| 372 expect( | 374 expect( |
| 373 manager.getLibrariesContainingPart(part2), unorderedEquals([library2])); | 375 manager.getLibrariesContainingPart(part2), unorderedEquals([library2])); |
| 374 expect(manager.getLibrariesContainingPart(part3), isEmpty); | 376 expect(manager.getLibrariesContainingPart(part3), isEmpty); |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 class _SourceFactoryMock extends TypedMock implements SourceFactory {} | 858 class _SourceFactoryMock extends TypedMock implements SourceFactory {} |
| 857 | 859 |
| 858 class _SourceMock extends TypedMock implements Source { | 860 class _SourceMock extends TypedMock implements Source { |
| 859 final String shortName; | 861 final String shortName; |
| 860 _SourceMock(this.shortName); | 862 _SourceMock(this.shortName); |
| 861 @override | 863 @override |
| 862 String get fullName => '/' + shortName; | 864 String get fullName => '/' + shortName; |
| 863 @override | 865 @override |
| 864 String toString() => fullName; | 866 String toString() => fullName; |
| 865 } | 867 } |
| OLD | NEW |