| 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/src/context/cache.dart'; | 8 import 'package:analyzer/src/context/cache.dart'; |
| 9 import 'package:analyzer/src/dart/scanner/scanner.dart' show ScannerErrorCode; | 9 import 'package:analyzer/src/dart/scanner/scanner.dart' show ScannerErrorCode; |
| 10 import 'package:analyzer/src/generated/engine.dart' | 10 import 'package:analyzer/src/generated/engine.dart' |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 class _InternalAnalysisContextMock extends TypedMock | 767 class _InternalAnalysisContextMock extends TypedMock |
| 768 implements InternalAnalysisContext { | 768 implements InternalAnalysisContext { |
| 769 @override | 769 @override |
| 770 CachePartition privateAnalysisCachePartition; | 770 CachePartition privateAnalysisCachePartition; |
| 771 | 771 |
| 772 @override | 772 @override |
| 773 AnalysisCache analysisCache; | 773 AnalysisCache analysisCache; |
| 774 | 774 |
| 775 Map<Source, ChangeNoticeImpl> _pendingNotices = <Source, ChangeNoticeImpl>{}; | 775 Map<Source, ChangeNoticeImpl> _pendingNotices = <Source, ChangeNoticeImpl>{}; |
| 776 | 776 |
| 777 @override |
| 778 final ReentrantSynchronousStream<InvalidatedResult> onResultInvalidated = |
| 779 new ReentrantSynchronousStream<InvalidatedResult>(); |
| 780 |
| 777 _InternalAnalysisContextMock() { | 781 _InternalAnalysisContextMock() { |
| 778 privateAnalysisCachePartition = new UniversalCachePartition(this); | 782 privateAnalysisCachePartition = new UniversalCachePartition(this); |
| 779 analysisCache = new AnalysisCache([privateAnalysisCachePartition]); | 783 analysisCache = new AnalysisCache([privateAnalysisCachePartition]); |
| 784 analysisCache.onResultInvalidated.listen((InvalidatedResult event) { |
| 785 onResultInvalidated.add(event); |
| 786 }); |
| 780 } | 787 } |
| 781 | 788 |
| 782 @override | 789 @override |
| 783 CacheEntry getCacheEntry(AnalysisTarget target) { | 790 CacheEntry getCacheEntry(AnalysisTarget target) { |
| 784 CacheEntry entry = analysisCache.get(target); | 791 CacheEntry entry = analysisCache.get(target); |
| 785 if (entry == null) { | 792 if (entry == null) { |
| 786 entry = new CacheEntry(target); | 793 entry = new CacheEntry(target); |
| 787 analysisCache.put(entry); | 794 analysisCache.put(entry); |
| 788 } | 795 } |
| 789 return entry; | 796 return entry; |
| 790 } | 797 } |
| 791 | 798 |
| 792 @override | 799 @override |
| 793 ChangeNoticeImpl getNotice(Source source) { | 800 ChangeNoticeImpl getNotice(Source source) { |
| 794 return _pendingNotices.putIfAbsent( | 801 return _pendingNotices.putIfAbsent( |
| 795 source, () => new ChangeNoticeImpl(source)); | 802 source, () => new ChangeNoticeImpl(source)); |
| 796 } | 803 } |
| 797 } | 804 } |
| 798 | 805 |
| 799 class _SourceFactoryMock extends TypedMock implements SourceFactory {} | 806 class _SourceFactoryMock extends TypedMock implements SourceFactory {} |
| 800 | 807 |
| 801 class _SourceMock extends TypedMock implements Source { | 808 class _SourceMock extends TypedMock implements Source { |
| 802 final String shortName; | 809 final String shortName; |
| 803 _SourceMock(this.shortName); | 810 _SourceMock(this.shortName); |
| 804 @override | 811 @override |
| 805 String get fullName => '/' + shortName; | 812 String get fullName => '/' + shortName; |
| 806 @override | 813 @override |
| 807 String toString() => fullName; | 814 String toString() => fullName; |
| 808 } | 815 } |
| OLD | NEW |