OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.engine_test; | 5 library engine.engine_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
(...skipping 13 matching lines...) Expand all Loading... |
24 import 'package:analyzer/src/generated/resolver.dart'; | 24 import 'package:analyzer/src/generated/resolver.dart'; |
25 import 'package:analyzer/src/generated/scanner.dart'; | 25 import 'package:analyzer/src/generated/scanner.dart'; |
26 import 'package:analyzer/src/generated/sdk.dart'; | 26 import 'package:analyzer/src/generated/sdk.dart'; |
27 import 'package:analyzer/src/generated/sdk_io.dart'; | 27 import 'package:analyzer/src/generated/sdk_io.dart'; |
28 import 'package:analyzer/src/generated/source_io.dart'; | 28 import 'package:analyzer/src/generated/source_io.dart'; |
29 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 29 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
30 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 30 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
31 import 'package:analyzer/src/generated/utilities_collection.dart'; | 31 import 'package:analyzer/src/generated/utilities_collection.dart'; |
32 import 'package:analyzer/src/services/lint.dart'; | 32 import 'package:analyzer/src/services/lint.dart'; |
33 import 'package:analyzer/src/string_source.dart'; | 33 import 'package:analyzer/src/string_source.dart'; |
34 import 'package:analyzer/task/model.dart' hide AnalysisTask, WorkManager; | 34 import 'package:analyzer/task/model.dart' as newContext; |
35 import 'package:html/dom.dart' show Document; | 35 import 'package:html/dom.dart' show Document; |
36 import 'package:path/path.dart' as pathos; | 36 import 'package:path/path.dart' as pathos; |
37 import 'package:typed_mock/typed_mock.dart'; | 37 import 'package:typed_mock/typed_mock.dart'; |
38 import 'package:unittest/unittest.dart'; | 38 import 'package:unittest/unittest.dart'; |
39 import 'package:watcher/src/utils.dart'; | 39 import 'package:watcher/src/utils.dart'; |
40 | 40 |
41 import '../reflective_tests.dart'; | 41 import '../reflective_tests.dart'; |
42 import '../utils.dart'; | 42 import '../utils.dart'; |
43 import 'all_the_rest_test.dart'; | 43 import 'all_the_rest_test.dart'; |
44 import 'resolver_test.dart'; | 44 import 'resolver_test.dart'; |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 completed = true; | 858 completed = true; |
859 }); | 859 }); |
860 return pumpEventQueue().then((_) { | 860 return pumpEventQueue().then((_) { |
861 expect(completed, isFalse); | 861 expect(completed, isFalse); |
862 _performPendingAnalysisTasks(); | 862 _performPendingAnalysisTasks(); |
863 }).then((_) => pumpEventQueue()).then((_) { | 863 }).then((_) => pumpEventQueue()).then((_) { |
864 expect(completed, isTrue); | 864 expect(completed, isTrue); |
865 }); | 865 }); |
866 } | 866 } |
867 | 867 |
| 868 void test_configurationData() { |
| 869 var key = new newContext.ResultDescriptor('test_key', ''); |
| 870 var testData = ['test', 'data']; |
| 871 _context.setConfigurationData(key, testData); |
| 872 expect(_context.getConfigurationData(key), testData); |
| 873 var unusedKey = new newContext.ResultDescriptor('unused_key', ''); |
| 874 expect(_context.getConfigurationData(unusedKey), null); |
| 875 } |
| 876 |
868 void test_dispose() { | 877 void test_dispose() { |
869 expect(_context.isDisposed, isFalse); | 878 expect(_context.isDisposed, isFalse); |
870 _context.dispose(); | 879 _context.dispose(); |
871 expect(_context.isDisposed, isTrue); | 880 expect(_context.isDisposed, isTrue); |
872 } | 881 } |
873 | 882 |
874 void test_exists_false() { | 883 void test_exists_false() { |
875 TestSource source = new TestSource(); | 884 TestSource source = new TestSource(); |
876 source.exists2 = false; | 885 source.exists2 = false; |
877 expect(_context.exists(source), isFalse); | 886 expect(_context.exists(source), isFalse); |
(...skipping 4810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5688 fail("Unexpected invocation of setContentCache"); | 5697 fail("Unexpected invocation of setContentCache"); |
5689 } | 5698 } |
5690 | 5699 |
5691 @override | 5700 @override |
5692 DeclaredVariables get declaredVariables { | 5701 DeclaredVariables get declaredVariables { |
5693 fail("Unexpected invocation of getDeclaredVariables"); | 5702 fail("Unexpected invocation of getDeclaredVariables"); |
5694 return null; | 5703 return null; |
5695 } | 5704 } |
5696 | 5705 |
5697 @override | 5706 @override |
5698 List<AnalysisTarget> get explicitTargets { | 5707 List<newContext.AnalysisTarget> get explicitTargets { |
5699 fail("Unexpected invocation of visitCacheItems"); | 5708 fail("Unexpected invocation of visitCacheItems"); |
5700 return null; | 5709 return null; |
5701 } | 5710 } |
5702 | 5711 |
5703 @override | 5712 @override |
5704 List<Source> get htmlSources { | 5713 List<Source> get htmlSources { |
5705 fail("Unexpected invocation of getHtmlSources"); | 5714 fail("Unexpected invocation of getHtmlSources"); |
5706 return null; | 5715 return null; |
5707 } | 5716 } |
5708 | 5717 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5759 return null; | 5768 return null; |
5760 } | 5769 } |
5761 | 5770 |
5762 @override | 5771 @override |
5763 List<Source> get prioritySources { | 5772 List<Source> get prioritySources { |
5764 fail("Unexpected invocation of getPrioritySources"); | 5773 fail("Unexpected invocation of getPrioritySources"); |
5765 return null; | 5774 return null; |
5766 } | 5775 } |
5767 | 5776 |
5768 @override | 5777 @override |
5769 List<AnalysisTarget> get priorityTargets { | 5778 List<newContext.AnalysisTarget> get priorityTargets { |
5770 fail("Unexpected invocation of visitCacheItems"); | 5779 fail("Unexpected invocation of visitCacheItems"); |
5771 return null; | 5780 return null; |
5772 } | 5781 } |
5773 | 5782 |
5774 @override | 5783 @override |
5775 CachePartition get privateAnalysisCachePartition { | 5784 CachePartition get privateAnalysisCachePartition { |
5776 fail("Unexpected invocation of privateAnalysisCachePartition"); | 5785 fail("Unexpected invocation of privateAnalysisCachePartition"); |
5777 return null; | 5786 return null; |
5778 } | 5787 } |
5779 | 5788 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5811 fail("Unexpected invocation of getTypeProvider"); | 5820 fail("Unexpected invocation of getTypeProvider"); |
5812 return null; | 5821 return null; |
5813 } | 5822 } |
5814 | 5823 |
5815 @override | 5824 @override |
5816 void set typeProvider(TypeProvider typeProvider) { | 5825 void set typeProvider(TypeProvider typeProvider) { |
5817 fail("Unexpected invocation of set typeProvider"); | 5826 fail("Unexpected invocation of set typeProvider"); |
5818 } | 5827 } |
5819 | 5828 |
5820 @override | 5829 @override |
| 5830 TypeResolverVisitorFactory get typeResolverVisitorFactory { |
| 5831 fail("Unexpected invocation of getTypeResolverVisitorFactory"); |
| 5832 return null; |
| 5833 } |
| 5834 |
| 5835 @override |
5821 TypeSystem get typeSystem { | 5836 TypeSystem get typeSystem { |
5822 fail("Unexpected invocation of getTypeSystem"); | 5837 fail("Unexpected invocation of getTypeSystem"); |
5823 return null; | 5838 return null; |
5824 } | 5839 } |
5825 | 5840 |
5826 @override | 5841 @override |
5827 TypeResolverVisitorFactory get typeResolverVisitorFactory { | 5842 List<newContext.WorkManager> get workManagers { |
5828 fail("Unexpected invocation of getTypeResolverVisitorFactory"); | 5843 fail("Unexpected invocation of workManagers"); |
5829 return null; | |
5830 } | 5844 } |
5831 | 5845 |
5832 @override | 5846 @override |
5833 void addListener(AnalysisListener listener) { | 5847 void addListener(AnalysisListener listener) { |
5834 fail("Unexpected invocation of addListener"); | 5848 fail("Unexpected invocation of addListener"); |
5835 } | 5849 } |
5836 | 5850 |
5837 @override | 5851 @override |
5838 void applyAnalysisDelta(AnalysisDelta delta) { | 5852 void applyAnalysisDelta(AnalysisDelta delta) { |
5839 fail("Unexpected invocation of applyAnalysisDelta"); | 5853 fail("Unexpected invocation of applyAnalysisDelta"); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5900 } | 5914 } |
5901 | 5915 |
5902 @override | 5916 @override |
5903 Future<CompilationUnit> computeResolvedCompilationUnitAsync( | 5917 Future<CompilationUnit> computeResolvedCompilationUnitAsync( |
5904 Source source, Source librarySource) { | 5918 Source source, Source librarySource) { |
5905 fail("Unexpected invocation of getResolvedCompilationUnitFuture"); | 5919 fail("Unexpected invocation of getResolvedCompilationUnitFuture"); |
5906 return null; | 5920 return null; |
5907 } | 5921 } |
5908 | 5922 |
5909 @override | 5923 @override |
5910 Object computeResult(AnalysisTarget target, ResultDescriptor result) { | 5924 Object computeResult( |
| 5925 newContext.AnalysisTarget target, newContext.ResultDescriptor result) { |
5911 fail("Unexpected invocation of computeResult"); | 5926 fail("Unexpected invocation of computeResult"); |
5912 return null; | 5927 return null; |
5913 } | 5928 } |
5914 | 5929 |
5915 @override | 5930 @override |
5916 void dispose() { | 5931 void dispose() { |
5917 fail("Unexpected invocation of dispose"); | 5932 fail("Unexpected invocation of dispose"); |
5918 } | 5933 } |
5919 | 5934 |
5920 @override | 5935 @override |
5921 List<CompilationUnit> ensureResolvedDartUnits(Source source) { | 5936 List<CompilationUnit> ensureResolvedDartUnits(Source source) { |
5922 fail("Unexpected invocation of ensureResolvedDartUnits"); | 5937 fail("Unexpected invocation of ensureResolvedDartUnits"); |
5923 return null; | 5938 return null; |
5924 } | 5939 } |
5925 | 5940 |
5926 @override | 5941 @override |
5927 bool exists(Source source) { | 5942 bool exists(Source source) { |
5928 fail("Unexpected invocation of exists"); | 5943 fail("Unexpected invocation of exists"); |
5929 return false; | 5944 return false; |
5930 } | 5945 } |
5931 | 5946 |
5932 @override | 5947 @override |
5933 CacheEntry getCacheEntry(AnalysisTarget target) { | 5948 CacheEntry getCacheEntry(newContext.AnalysisTarget target) { |
5934 fail("Unexpected invocation of visitCacheItems"); | 5949 fail("Unexpected invocation of visitCacheItems"); |
5935 return null; | 5950 return null; |
5936 } | 5951 } |
5937 | 5952 |
5938 @override | 5953 @override |
5939 CompilationUnitElement getCompilationUnitElement( | 5954 CompilationUnitElement getCompilationUnitElement( |
5940 Source unitSource, Source librarySource) { | 5955 Source unitSource, Source librarySource) { |
5941 fail("Unexpected invocation of getCompilationUnitElement"); | 5956 fail("Unexpected invocation of getCompilationUnitElement"); |
5942 return null; | 5957 return null; |
5943 } | 5958 } |
5944 | 5959 |
5945 @override | 5960 @override |
| 5961 Object getConfigurationData(newContext.ResultDescriptor key) { |
| 5962 fail("Unexpected invocation of getConfigurationData"); |
| 5963 } |
| 5964 |
| 5965 @override |
5946 TimestampedData<String> getContents(Source source) { | 5966 TimestampedData<String> getContents(Source source) { |
5947 fail("Unexpected invocation of getContents"); | 5967 fail("Unexpected invocation of getContents"); |
5948 return null; | 5968 return null; |
5949 } | 5969 } |
5950 | 5970 |
5951 @override | 5971 @override |
5952 InternalAnalysisContext getContextFor(Source source) { | 5972 InternalAnalysisContext getContextFor(Source source) { |
5953 fail("Unexpected invocation of getContextFor"); | 5973 fail("Unexpected invocation of getContextFor"); |
5954 return null; | 5974 return null; |
5955 } | 5975 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6048 } | 6068 } |
6049 | 6069 |
6050 @override | 6070 @override |
6051 @deprecated | 6071 @deprecated |
6052 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) { | 6072 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) { |
6053 fail("Unexpected invocation of getResolvedHtmlUnit"); | 6073 fail("Unexpected invocation of getResolvedHtmlUnit"); |
6054 return null; | 6074 return null; |
6055 } | 6075 } |
6056 | 6076 |
6057 @override | 6077 @override |
6058 Object getResult(AnalysisTarget target, ResultDescriptor result) { | 6078 Object getResult( |
| 6079 newContext.AnalysisTarget target, newContext.ResultDescriptor result) { |
6059 fail("Unexpected invocation of getResult"); | 6080 fail("Unexpected invocation of getResult"); |
6060 return null; | 6081 return null; |
6061 } | 6082 } |
6062 | 6083 |
6063 @override | 6084 @override |
6064 List<Source> getSourcesWithFullName(String path) { | 6085 List<Source> getSourcesWithFullName(String path) { |
6065 fail("Unexpected invocation of getSourcesWithFullName"); | 6086 fail("Unexpected invocation of getSourcesWithFullName"); |
6066 return null; | 6087 return null; |
6067 } | 6088 } |
6068 | 6089 |
(...skipping 15 matching lines...) Expand all Loading... |
6084 return false; | 6105 return false; |
6085 } | 6106 } |
6086 | 6107 |
6087 @override | 6108 @override |
6088 bool isServerLibrary(Source librarySource) { | 6109 bool isServerLibrary(Source librarySource) { |
6089 fail("Unexpected invocation of isServerLibrary"); | 6110 fail("Unexpected invocation of isServerLibrary"); |
6090 return false; | 6111 return false; |
6091 } | 6112 } |
6092 | 6113 |
6093 @override | 6114 @override |
6094 Stream<ComputedResult> onResultComputed(ResultDescriptor descriptor) { | 6115 Stream<ComputedResult> onResultComputed( |
| 6116 newContext.ResultDescriptor descriptor) { |
6095 fail("Unexpected invocation of onResultComputed"); | 6117 fail("Unexpected invocation of onResultComputed"); |
6096 return null; | 6118 return null; |
6097 } | 6119 } |
6098 | 6120 |
6099 @override | 6121 @override |
6100 CompilationUnit parseCompilationUnit(Source source) { | 6122 CompilationUnit parseCompilationUnit(Source source) { |
6101 fail("Unexpected invocation of parseCompilationUnit"); | 6123 fail("Unexpected invocation of parseCompilationUnit"); |
6102 return null; | 6124 return null; |
6103 } | 6125 } |
6104 | 6126 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6151 return null; | 6173 return null; |
6152 } | 6174 } |
6153 | 6175 |
6154 @override | 6176 @override |
6155 void setChangedContents(Source source, String contents, int offset, | 6177 void setChangedContents(Source source, String contents, int offset, |
6156 int oldLength, int newLength) { | 6178 int oldLength, int newLength) { |
6157 fail("Unexpected invocation of setChangedContents"); | 6179 fail("Unexpected invocation of setChangedContents"); |
6158 } | 6180 } |
6159 | 6181 |
6160 @override | 6182 @override |
| 6183 void setConfigurationData(newContext.ResultDescriptor key, Object data) { |
| 6184 fail("Unexpected invocation of setConfigurationData"); |
| 6185 } |
| 6186 |
| 6187 @override |
6161 void setContents(Source source, String contents) { | 6188 void setContents(Source source, String contents) { |
6162 fail("Unexpected invocation of setContents"); | 6189 fail("Unexpected invocation of setContents"); |
6163 } | 6190 } |
6164 | 6191 |
6165 @override | 6192 @override |
6166 bool shouldErrorsBeAnalyzed(Source source, Object entry) { | 6193 bool shouldErrorsBeAnalyzed(Source source, Object entry) { |
6167 fail("Unexpected invocation of shouldErrorsBeAnalyzed"); | 6194 fail("Unexpected invocation of shouldErrorsBeAnalyzed"); |
6168 return false; | 6195 return false; |
6169 } | 6196 } |
6170 | 6197 |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7012 @override | 7039 @override |
7013 bool exists() => true; | 7040 bool exists() => true; |
7014 } | 7041 } |
7015 | 7042 |
7016 class _UniversalCachePartitionTest_test_setMaxCacheSize | 7043 class _UniversalCachePartitionTest_test_setMaxCacheSize |
7017 implements CacheRetentionPolicy { | 7044 implements CacheRetentionPolicy { |
7018 @override | 7045 @override |
7019 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => | 7046 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => |
7020 RetentionPriority.LOW; | 7047 RetentionPriority.LOW; |
7021 } | 7048 } |
OLD | NEW |