| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.engine_test; | 8 library engine.engine_test; |
| 9 | 9 |
| 10 import 'dart:async'; | 10 import 'dart:async'; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 runReflectiveTests(ResolveDartUnitTaskTest); | 63 runReflectiveTests(ResolveDartUnitTaskTest); |
| 64 runReflectiveTests(ResolveHtmlTaskTest); | 64 runReflectiveTests(ResolveHtmlTaskTest); |
| 65 runReflectiveTests(ScanDartTaskTest); | 65 runReflectiveTests(ScanDartTaskTest); |
| 66 runReflectiveTests(SdkCachePartitionTest); | 66 runReflectiveTests(SdkCachePartitionTest); |
| 67 runReflectiveTests(SourcesChangedEventTest); | 67 runReflectiveTests(SourcesChangedEventTest); |
| 68 runReflectiveTests(UniversalCachePartitionTest); | 68 runReflectiveTests(UniversalCachePartitionTest); |
| 69 runReflectiveTests(WorkManagerTest); | 69 runReflectiveTests(WorkManagerTest); |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 @ReflectiveTestCase() | 73 @reflectiveTest |
| 74 class AnalysisCacheTest extends EngineTestCase { | 74 class AnalysisCacheTest extends EngineTestCase { |
| 75 void test_creation() { | 75 void test_creation() { |
| 76 expect(new AnalysisCache(new List<CachePartition>(0)), isNotNull); | 76 expect(new AnalysisCache(new List<CachePartition>(0)), isNotNull); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void test_get() { | 79 void test_get() { |
| 80 AnalysisCache cache = new AnalysisCache(new List<CachePartition>(0)); | 80 AnalysisCache cache = new AnalysisCache(new List<CachePartition>(0)); |
| 81 TestSource source = new TestSource(); | 81 TestSource source = new TestSource(); |
| 82 expect(cache.get(source), isNull); | 82 expect(cache.get(source), isNull); |
| 83 } | 83 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 if (iterator.value.getState(DartEntry.PARSED_UNIT) != | 146 if (iterator.value.getState(DartEntry.PARSED_UNIT) != |
| 147 CacheState.FLUSHED) { | 147 CacheState.FLUSHED) { |
| 148 nonFlushedCount++; | 148 nonFlushedCount++; |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 expect(nonFlushedCount, expectedCount); | 151 expect(nonFlushedCount, expectedCount); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 | 155 |
| 156 @ReflectiveTestCase() | 156 @reflectiveTest |
| 157 class AnalysisContextImplTest extends EngineTestCase { | 157 class AnalysisContextImplTest extends EngineTestCase { |
| 158 /** | 158 /** |
| 159 * An analysis context whose source factory is [sourceFactory]. | 159 * An analysis context whose source factory is [sourceFactory]. |
| 160 */ | 160 */ |
| 161 AnalysisContextImpl _context; | 161 AnalysisContextImpl _context; |
| 162 | 162 |
| 163 /** | 163 /** |
| 164 * The source factory associated with the analysis [context]. | 164 * The source factory associated with the analysis [context]. |
| 165 */ | 165 */ |
| 166 SourceFactory _sourceFactory; | 166 SourceFactory _sourceFactory; |
| (...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2235 | 2235 |
| 2236 class AnalysisContextImplTest_Source_getModificationStamp_overridden extends | 2236 class AnalysisContextImplTest_Source_getModificationStamp_overridden extends |
| 2237 TestSource { | 2237 TestSource { |
| 2238 int stamp; | 2238 int stamp; |
| 2239 AnalysisContextImplTest_Source_getModificationStamp_overridden(this.stamp); | 2239 AnalysisContextImplTest_Source_getModificationStamp_overridden(this.stamp); |
| 2240 @override | 2240 @override |
| 2241 int get modificationStamp => stamp; | 2241 int get modificationStamp => stamp; |
| 2242 } | 2242 } |
| 2243 | 2243 |
| 2244 | 2244 |
| 2245 @ReflectiveTestCase() | 2245 @reflectiveTest |
| 2246 class AnalysisOptionsImplTest extends EngineTestCase { | 2246 class AnalysisOptionsImplTest extends EngineTestCase { |
| 2247 void test_AnalysisOptionsImpl_copy() { | 2247 void test_AnalysisOptionsImpl_copy() { |
| 2248 bool booleanValue = true; | 2248 bool booleanValue = true; |
| 2249 for (int i = 0; i < 2; i++, booleanValue = !booleanValue) { | 2249 for (int i = 0; i < 2; i++, booleanValue = !booleanValue) { |
| 2250 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | 2250 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| 2251 options.analyzeFunctionBodies = booleanValue; | 2251 options.analyzeFunctionBodies = booleanValue; |
| 2252 options.cacheSize = i; | 2252 options.cacheSize = i; |
| 2253 options.dart2jsHint = booleanValue; | 2253 options.dart2jsHint = booleanValue; |
| 2254 options.generateSdkErrors = booleanValue; | 2254 options.generateSdkErrors = booleanValue; |
| 2255 options.hint = booleanValue; | 2255 options.hint = booleanValue; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2328 expect(exception, isNotNull); | 2328 expect(exception, isNotNull); |
| 2329 return null; | 2329 return null; |
| 2330 } | 2330 } |
| 2331 @override | 2331 @override |
| 2332 void internalPerform() { | 2332 void internalPerform() { |
| 2333 throw new AnalysisException("Forced exception"); | 2333 throw new AnalysisException("Forced exception"); |
| 2334 } | 2334 } |
| 2335 } | 2335 } |
| 2336 | 2336 |
| 2337 | 2337 |
| 2338 @ReflectiveTestCase() | 2338 @reflectiveTest |
| 2339 class AnalysisTaskTest extends EngineTestCase { | 2339 class AnalysisTaskTest extends EngineTestCase { |
| 2340 void test_perform_exception() { | 2340 void test_perform_exception() { |
| 2341 InternalAnalysisContext context = new AnalysisContextImpl(); | 2341 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 2342 context.sourceFactory = new SourceFactory([new FileUriResolver()]); | 2342 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 2343 AnalysisTask task = new AnalysisTask_test_perform_exception(context); | 2343 AnalysisTask task = new AnalysisTask_test_perform_exception(context); |
| 2344 task.perform(new TestTaskVisitor<Object>()); | 2344 task.perform(new TestTaskVisitor<Object>()); |
| 2345 } | 2345 } |
| 2346 } | 2346 } |
| 2347 | 2347 |
| 2348 | 2348 |
| 2349 class CompilationUnitMock extends TypedMock implements CompilationUnit { | 2349 class CompilationUnitMock extends TypedMock implements CompilationUnit { |
| 2350 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 2350 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 2351 } | 2351 } |
| 2352 | 2352 |
| 2353 | 2353 |
| 2354 @ReflectiveTestCase() | 2354 @reflectiveTest |
| 2355 class DartEntryTest extends EngineTestCase { | 2355 class DartEntryTest extends EngineTestCase { |
| 2356 void test_allErrors() { | 2356 void test_allErrors() { |
| 2357 Source source = new TestSource(); | 2357 Source source = new TestSource(); |
| 2358 DartEntry entry = new DartEntry(); | 2358 DartEntry entry = new DartEntry(); |
| 2359 expect(entry.allErrors, hasLength(0)); | 2359 expect(entry.allErrors, hasLength(0)); |
| 2360 entry.setValue( | 2360 entry.setValue( |
| 2361 DartEntry.SCAN_ERRORS, | 2361 DartEntry.SCAN_ERRORS, |
| 2362 <AnalysisError>[ | 2362 <AnalysisError>[ |
| 2363 new AnalysisError.con1(source, ScannerErrorCode.UNTERMINATED_STRING_
LITERAL)]); | 2363 new AnalysisError.con1(source, ScannerErrorCode.UNTERMINATED_STRING_
LITERAL)]); |
| 2364 entry.setValue( | 2364 entry.setValue( |
| (...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3789 DartEntry entry = new DartEntry(); | 3789 DartEntry entry = new DartEntry(); |
| 3790 Object value = entry.getValueInLibrary(descriptor, source); | 3790 Object value = entry.getValueInLibrary(descriptor, source); |
| 3791 expect(newValue, isNot(same(value))); | 3791 expect(newValue, isNot(same(value))); |
| 3792 entry.setValueInLibrary(descriptor, source, newValue); | 3792 entry.setValueInLibrary(descriptor, source, newValue); |
| 3793 expect(entry.getStateInLibrary(descriptor, source), same(CacheState.VALID)); | 3793 expect(entry.getStateInLibrary(descriptor, source), same(CacheState.VALID)); |
| 3794 expect(entry.getValueInLibrary(descriptor, source), same(newValue)); | 3794 expect(entry.getValueInLibrary(descriptor, source), same(newValue)); |
| 3795 } | 3795 } |
| 3796 } | 3796 } |
| 3797 | 3797 |
| 3798 | 3798 |
| 3799 @ReflectiveTestCase() | 3799 @reflectiveTest |
| 3800 class GenerateDartErrorsTaskTest extends EngineTestCase { | 3800 class GenerateDartErrorsTaskTest extends EngineTestCase { |
| 3801 void test_accept() { | 3801 void test_accept() { |
| 3802 GenerateDartErrorsTask task = | 3802 GenerateDartErrorsTask task = |
| 3803 new GenerateDartErrorsTask(null, null, null, null); | 3803 new GenerateDartErrorsTask(null, null, null, null); |
| 3804 expect(task.accept(new GenerateDartErrorsTaskTestTV_accept()), isTrue); | 3804 expect(task.accept(new GenerateDartErrorsTaskTestTV_accept()), isTrue); |
| 3805 } | 3805 } |
| 3806 | 3806 |
| 3807 void test_getException() { | 3807 void test_getException() { |
| 3808 GenerateDartErrorsTask task = | 3808 GenerateDartErrorsTask task = |
| 3809 new GenerateDartErrorsTask(null, null, null, null); | 3809 new GenerateDartErrorsTask(null, null, null, null); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3918 expect(task.libraryElement, same(libraryElement)); | 3918 expect(task.libraryElement, same(libraryElement)); |
| 3919 expect(task.source, same(source)); | 3919 expect(task.source, same(source)); |
| 3920 List<AnalysisError> errors = task.errors; | 3920 List<AnalysisError> errors = task.errors; |
| 3921 expect(errors, hasLength(1)); | 3921 expect(errors, hasLength(1)); |
| 3922 expect(errors[0].errorCode, same(CompileTimeErrorCode.URI_DOES_NOT_EXIST)); | 3922 expect(errors[0].errorCode, same(CompileTimeErrorCode.URI_DOES_NOT_EXIST)); |
| 3923 return true; | 3923 return true; |
| 3924 } | 3924 } |
| 3925 } | 3925 } |
| 3926 | 3926 |
| 3927 | 3927 |
| 3928 @ReflectiveTestCase() | 3928 @reflectiveTest |
| 3929 class GenerateDartHintsTaskTest extends EngineTestCase { | 3929 class GenerateDartHintsTaskTest extends EngineTestCase { |
| 3930 void test_accept() { | 3930 void test_accept() { |
| 3931 GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null); | 3931 GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null); |
| 3932 expect(task.accept(new GenerateDartHintsTaskTestTV_accept()), isTrue); | 3932 expect(task.accept(new GenerateDartHintsTaskTestTV_accept()), isTrue); |
| 3933 } | 3933 } |
| 3934 void test_getException() { | 3934 void test_getException() { |
| 3935 GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null); | 3935 GenerateDartHintsTask task = new GenerateDartHintsTask(null, null, null); |
| 3936 expect(task.exception, isNull); | 3936 expect(task.exception, isNull); |
| 3937 } | 3937 } |
| 3938 void test_getHintMap() { | 3938 void test_getHintMap() { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3999 } | 3999 } |
| 4000 expect(task.libraryElement, isNotNull); | 4000 expect(task.libraryElement, isNotNull); |
| 4001 HashMap<Source, List<AnalysisError>> hintMap = task.hintMap; | 4001 HashMap<Source, List<AnalysisError>> hintMap = task.hintMap; |
| 4002 expect(hintMap, hasLength(2)); | 4002 expect(hintMap, hasLength(2)); |
| 4003 expect(hintMap[librarySource], hasLength(1)); | 4003 expect(hintMap[librarySource], hasLength(1)); |
| 4004 expect(hintMap[partSource], hasLength(0)); | 4004 expect(hintMap[partSource], hasLength(0)); |
| 4005 return true; | 4005 return true; |
| 4006 } | 4006 } |
| 4007 } | 4007 } |
| 4008 | 4008 |
| 4009 @ReflectiveTestCase() | 4009 @reflectiveTest |
| 4010 class GenerateDartLintsTaskTest extends EngineTestCase { | 4010 class GenerateDartLintsTaskTest extends EngineTestCase { |
| 4011 void test_accept() { | 4011 void test_accept() { |
| 4012 GenerateDartLintsTask task = new GenerateDartLintsTask(null, null, null); | 4012 GenerateDartLintsTask task = new GenerateDartLintsTask(null, null, null); |
| 4013 expect(task.accept(new GenerateDartLintsTaskTestTV_accept()), isTrue); | 4013 expect(task.accept(new GenerateDartLintsTaskTestTV_accept()), isTrue); |
| 4014 } | 4014 } |
| 4015 void test_exception() { | 4015 void test_exception() { |
| 4016 GenerateDartLintsTask task = new GenerateDartLintsTask(null, null, null); | 4016 GenerateDartLintsTask task = new GenerateDartLintsTask(null, null, null); |
| 4017 expect(task.exception, isNull); | 4017 expect(task.exception, isNull); |
| 4018 } | 4018 } |
| 4019 void test_lintMap() { | 4019 void test_lintMap() { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4062 bool visitGenerateDartLintsTask(GenerateDartLintsTask task) { | 4062 bool visitGenerateDartLintsTask(GenerateDartLintsTask task) { |
| 4063 CaughtException exception = task.exception; | 4063 CaughtException exception = task.exception; |
| 4064 if (exception != null) { | 4064 if (exception != null) { |
| 4065 throw exception; | 4065 throw exception; |
| 4066 } | 4066 } |
| 4067 expect(task.libraryElement, isNotNull); | 4067 expect(task.libraryElement, isNotNull); |
| 4068 return true; | 4068 return true; |
| 4069 } | 4069 } |
| 4070 } | 4070 } |
| 4071 | 4071 |
| 4072 @ReflectiveTestCase() | 4072 @reflectiveTest |
| 4073 class LintGeneratorTest extends EngineTestCase { | 4073 class LintGeneratorTest extends EngineTestCase { |
| 4074 void test_generate() { | 4074 void test_generate() { |
| 4075 | 4075 |
| 4076 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); | 4076 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 4077 ChangeSet changeSet = new ChangeSet(); | 4077 ChangeSet changeSet = new ChangeSet(); |
| 4078 Source librarySource = | 4078 Source librarySource = |
| 4079 new FileBasedSource.con1(FileUtilities2.createFile("/test.dart")); | 4079 new FileBasedSource.con1(FileUtilities2.createFile("/test.dart")); |
| 4080 changeSet.addedSource(librarySource); | 4080 changeSet.addedSource(librarySource); |
| 4081 context.applyChanges(changeSet); | 4081 context.applyChanges(changeSet); |
| 4082 context.setContents(librarySource, r''' | 4082 context.setContents(librarySource, r''' |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4111 return null; | 4111 return null; |
| 4112 } | 4112 } |
| 4113 | 4113 |
| 4114 testExpectations() { | 4114 testExpectations() { |
| 4115 expect(reporter, isNotNull); | 4115 expect(reporter, isNotNull); |
| 4116 expect(visited, isTrue); | 4116 expect(visited, isTrue); |
| 4117 } | 4117 } |
| 4118 } | 4118 } |
| 4119 | 4119 |
| 4120 | 4120 |
| 4121 @ReflectiveTestCase() | 4121 @reflectiveTest |
| 4122 class GetContentTaskTest extends EngineTestCase { | 4122 class GetContentTaskTest extends EngineTestCase { |
| 4123 void test_accept() { | 4123 void test_accept() { |
| 4124 Source source = new TestSource('/test.dart', ''); | 4124 Source source = new TestSource('/test.dart', ''); |
| 4125 GetContentTask task = new GetContentTask(null, source); | 4125 GetContentTask task = new GetContentTask(null, source); |
| 4126 expect(task.accept(new GetContentTaskTestTV_accept()), isTrue); | 4126 expect(task.accept(new GetContentTaskTestTV_accept()), isTrue); |
| 4127 } | 4127 } |
| 4128 | 4128 |
| 4129 void test_getException() { | 4129 void test_getException() { |
| 4130 Source source = new TestSource('/test.dart', ''); | 4130 Source source = new TestSource('/test.dart', ''); |
| 4131 GetContentTask task = new GetContentTask(null, source); | 4131 GetContentTask task = new GetContentTask(null, source); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4188 if (exception != null) { | 4188 if (exception != null) { |
| 4189 throw exception; | 4189 throw exception; |
| 4190 } | 4190 } |
| 4191 expect(task.modificationTime, context.getModificationStamp(source)); | 4191 expect(task.modificationTime, context.getModificationStamp(source)); |
| 4192 expect(task.source, same(source)); | 4192 expect(task.source, same(source)); |
| 4193 return true; | 4193 return true; |
| 4194 } | 4194 } |
| 4195 } | 4195 } |
| 4196 | 4196 |
| 4197 | 4197 |
| 4198 @ReflectiveTestCase() | 4198 @reflectiveTest |
| 4199 class HtmlEntryTest extends EngineTestCase { | 4199 class HtmlEntryTest extends EngineTestCase { |
| 4200 void set state(DataDescriptor descriptor) { | 4200 void set state(DataDescriptor descriptor) { |
| 4201 HtmlEntry entry = new HtmlEntry(); | 4201 HtmlEntry entry = new HtmlEntry(); |
| 4202 expect(entry.getState(descriptor), isNot(same(CacheState.FLUSHED))); | 4202 expect(entry.getState(descriptor), isNot(same(CacheState.FLUSHED))); |
| 4203 entry.setState(descriptor, CacheState.FLUSHED); | 4203 entry.setState(descriptor, CacheState.FLUSHED); |
| 4204 expect(entry.getState(descriptor), same(CacheState.FLUSHED)); | 4204 expect(entry.getState(descriptor), same(CacheState.FLUSHED)); |
| 4205 } | 4205 } |
| 4206 | 4206 |
| 4207 void test_creation() { | 4207 void test_creation() { |
| 4208 HtmlEntry entry = new HtmlEntry(); | 4208 HtmlEntry entry = new HtmlEntry(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4357 HtmlEntry entry = new HtmlEntry(); | 4357 HtmlEntry entry = new HtmlEntry(); |
| 4358 Object value = entry.getValue(descriptor); | 4358 Object value = entry.getValue(descriptor); |
| 4359 expect(newValue, isNot(same(value))); | 4359 expect(newValue, isNot(same(value))); |
| 4360 entry.setValue(descriptor, newValue); | 4360 entry.setValue(descriptor, newValue); |
| 4361 expect(entry.getState(descriptor), same(CacheState.VALID)); | 4361 expect(entry.getState(descriptor), same(CacheState.VALID)); |
| 4362 expect(entry.getValue(descriptor), same(newValue)); | 4362 expect(entry.getValue(descriptor), same(newValue)); |
| 4363 } | 4363 } |
| 4364 } | 4364 } |
| 4365 | 4365 |
| 4366 | 4366 |
| 4367 @ReflectiveTestCase() | 4367 @reflectiveTest |
| 4368 class IncrementalAnalysisCacheTest { | 4368 class IncrementalAnalysisCacheTest { |
| 4369 Source _source = new TestSource(); | 4369 Source _source = new TestSource(); |
| 4370 DartEntry _entry = new DartEntry(); | 4370 DartEntry _entry = new DartEntry(); |
| 4371 CompilationUnit _unit = new CompilationUnitMock(); | 4371 CompilationUnit _unit = new CompilationUnitMock(); |
| 4372 IncrementalAnalysisCache _result; | 4372 IncrementalAnalysisCache _result; |
| 4373 void setUp() { | 4373 void setUp() { |
| 4374 _entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, _unit); | 4374 _entry.setValueInLibrary(DartEntry.RESOLVED_UNIT, _source, _unit); |
| 4375 } | 4375 } |
| 4376 void test_cacheResult() { | 4376 void test_cacheResult() { |
| 4377 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( | 4377 IncrementalAnalysisCache cache = IncrementalAnalysisCache.update( |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4882 Scanner scanner = new Scanner( | 4882 Scanner scanner = new Scanner( |
| 4883 _source, | 4883 _source, |
| 4884 new CharSequenceReader(code), | 4884 new CharSequenceReader(code), |
| 4885 AnalysisErrorListener.NULL_LISTENER); | 4885 AnalysisErrorListener.NULL_LISTENER); |
| 4886 Parser parser = new Parser(_source, AnalysisErrorListener.NULL_LISTENER); | 4886 Parser parser = new Parser(_source, AnalysisErrorListener.NULL_LISTENER); |
| 4887 return parser.parseCompilationUnit(scanner.tokenize()); | 4887 return parser.parseCompilationUnit(scanner.tokenize()); |
| 4888 } | 4888 } |
| 4889 } | 4889 } |
| 4890 | 4890 |
| 4891 | 4891 |
| 4892 @ReflectiveTestCase() | 4892 @reflectiveTest |
| 4893 class IncrementalAnalysisTaskTest extends EngineTestCase { | 4893 class IncrementalAnalysisTaskTest extends EngineTestCase { |
| 4894 void test_accept() { | 4894 void test_accept() { |
| 4895 IncrementalAnalysisTask task = new IncrementalAnalysisTask(null, null); | 4895 IncrementalAnalysisTask task = new IncrementalAnalysisTask(null, null); |
| 4896 expect(task.accept(new IncrementalAnalysisTaskTestTV_accept()), isTrue); | 4896 expect(task.accept(new IncrementalAnalysisTaskTestTV_accept()), isTrue); |
| 4897 } | 4897 } |
| 4898 | 4898 |
| 4899 void test_perform() { | 4899 void test_perform() { |
| 4900 // main() {} String foo; | 4900 // main() {} String foo; |
| 4901 // main() {String} String foo; | 4901 // main() {String} String foo; |
| 4902 CompilationUnit newUnit = | 4902 CompilationUnit newUnit = |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4959 TestTaskVisitor<CompilationUnit> { | 4959 TestTaskVisitor<CompilationUnit> { |
| 4960 IncrementalAnalysisTask task; | 4960 IncrementalAnalysisTask task; |
| 4961 IncrementalAnalysisTaskTestTV_assertTask(this.task); | 4961 IncrementalAnalysisTaskTestTV_assertTask(this.task); |
| 4962 @override | 4962 @override |
| 4963 CompilationUnit | 4963 CompilationUnit |
| 4964 visitIncrementalAnalysisTask(IncrementalAnalysisTask incrementalAnalysisTa
sk) => | 4964 visitIncrementalAnalysisTask(IncrementalAnalysisTask incrementalAnalysisTa
sk) => |
| 4965 task.compilationUnit; | 4965 task.compilationUnit; |
| 4966 } | 4966 } |
| 4967 | 4967 |
| 4968 | 4968 |
| 4969 @ReflectiveTestCase() | 4969 @reflectiveTest |
| 4970 class ParseDartTaskTest extends EngineTestCase { | 4970 class ParseDartTaskTest extends EngineTestCase { |
| 4971 void test_accept() { | 4971 void test_accept() { |
| 4972 ParseDartTask task = new ParseDartTask(null, null, null, null); | 4972 ParseDartTask task = new ParseDartTask(null, null, null, null); |
| 4973 expect(task.accept(new ParseDartTaskTestTV_accept()), isTrue); | 4973 expect(task.accept(new ParseDartTaskTestTV_accept()), isTrue); |
| 4974 } | 4974 } |
| 4975 | 4975 |
| 4976 void test_getCompilationUnit() { | 4976 void test_getCompilationUnit() { |
| 4977 ParseDartTask task = new ParseDartTask(null, null, null, null); | 4977 ParseDartTask task = new ParseDartTask(null, null, null, null); |
| 4978 expect(task.compilationUnit, isNull); | 4978 expect(task.compilationUnit, isNull); |
| 4979 } | 4979 } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5157 CompileTimeErrorCode.URI_WITH_INTERPOLATION, | 5157 CompileTimeErrorCode.URI_WITH_INTERPOLATION, |
| 5158 CompileTimeErrorCode.INVALID_URI]); | 5158 CompileTimeErrorCode.INVALID_URI]); |
| 5159 expect(task.source, same(source)); | 5159 expect(task.source, same(source)); |
| 5160 expect(task.hasNonPartOfDirective, isTrue); | 5160 expect(task.hasNonPartOfDirective, isTrue); |
| 5161 expect(task.hasPartOfDirective, isFalse); | 5161 expect(task.hasPartOfDirective, isFalse); |
| 5162 return null; | 5162 return null; |
| 5163 } | 5163 } |
| 5164 } | 5164 } |
| 5165 | 5165 |
| 5166 | 5166 |
| 5167 @ReflectiveTestCase() | 5167 @reflectiveTest |
| 5168 class ParseHtmlTaskTest extends EngineTestCase { | 5168 class ParseHtmlTaskTest extends EngineTestCase { |
| 5169 ParseHtmlTask parseContents(String contents, TestLogger testLogger) { | 5169 ParseHtmlTask parseContents(String contents, TestLogger testLogger) { |
| 5170 return parseSource( | 5170 return parseSource( |
| 5171 new TestSource('/test.dart', contents), | 5171 new TestSource('/test.dart', contents), |
| 5172 contents, | 5172 contents, |
| 5173 testLogger); | 5173 testLogger); |
| 5174 } | 5174 } |
| 5175 | 5175 |
| 5176 ParseHtmlTask parseSource(Source source, String contents, | 5176 ParseHtmlTask parseSource(Source source, String contents, |
| 5177 TestLogger testLogger) { | 5177 TestLogger testLogger) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5341 throw exception; | 5341 throw exception; |
| 5342 } | 5342 } |
| 5343 expect(task.htmlUnit, isNotNull); | 5343 expect(task.htmlUnit, isNotNull); |
| 5344 expect(task.lineInfo, isNotNull); | 5344 expect(task.lineInfo, isNotNull); |
| 5345 expect(task.source, same(source)); | 5345 expect(task.source, same(source)); |
| 5346 return true; | 5346 return true; |
| 5347 } | 5347 } |
| 5348 } | 5348 } |
| 5349 | 5349 |
| 5350 | 5350 |
| 5351 @ReflectiveTestCase() | 5351 @reflectiveTest |
| 5352 class PartitionManagerTest extends EngineTestCase { | 5352 class PartitionManagerTest extends EngineTestCase { |
| 5353 void test_clearCache() { | 5353 void test_clearCache() { |
| 5354 PartitionManager manager = new PartitionManager(); | 5354 PartitionManager manager = new PartitionManager(); |
| 5355 DartSdk sdk = new MockDartSdk(); | 5355 DartSdk sdk = new MockDartSdk(); |
| 5356 SdkCachePartition oldPartition = manager.forSdk(sdk); | 5356 SdkCachePartition oldPartition = manager.forSdk(sdk); |
| 5357 manager.clearCache(); | 5357 manager.clearCache(); |
| 5358 SdkCachePartition newPartition = manager.forSdk(sdk); | 5358 SdkCachePartition newPartition = manager.forSdk(sdk); |
| 5359 expect(newPartition, isNot(same(oldPartition))); | 5359 expect(newPartition, isNot(same(oldPartition))); |
| 5360 } | 5360 } |
| 5361 | 5361 |
| 5362 void test_creation() { | 5362 void test_creation() { |
| 5363 expect(new PartitionManager(), isNotNull); | 5363 expect(new PartitionManager(), isNotNull); |
| 5364 } | 5364 } |
| 5365 | 5365 |
| 5366 void test_forSdk() { | 5366 void test_forSdk() { |
| 5367 PartitionManager manager = new PartitionManager(); | 5367 PartitionManager manager = new PartitionManager(); |
| 5368 DartSdk sdk1 = new MockDartSdk(); | 5368 DartSdk sdk1 = new MockDartSdk(); |
| 5369 SdkCachePartition partition1 = manager.forSdk(sdk1); | 5369 SdkCachePartition partition1 = manager.forSdk(sdk1); |
| 5370 expect(partition1, isNotNull); | 5370 expect(partition1, isNotNull); |
| 5371 expect(manager.forSdk(sdk1), same(partition1)); | 5371 expect(manager.forSdk(sdk1), same(partition1)); |
| 5372 DartSdk sdk2 = new MockDartSdk(); | 5372 DartSdk sdk2 = new MockDartSdk(); |
| 5373 SdkCachePartition partition2 = manager.forSdk(sdk2); | 5373 SdkCachePartition partition2 = manager.forSdk(sdk2); |
| 5374 expect(partition2, isNotNull); | 5374 expect(partition2, isNotNull); |
| 5375 expect(manager.forSdk(sdk2), same(partition2)); | 5375 expect(manager.forSdk(sdk2), same(partition2)); |
| 5376 expect(partition2, isNot(same(partition1))); | 5376 expect(partition2, isNot(same(partition1))); |
| 5377 } | 5377 } |
| 5378 } | 5378 } |
| 5379 | 5379 |
| 5380 | 5380 |
| 5381 @ReflectiveTestCase() | 5381 @reflectiveTest |
| 5382 class ResolveDartLibraryTaskTest extends EngineTestCase { | 5382 class ResolveDartLibraryTaskTest extends EngineTestCase { |
| 5383 void test_accept() { | 5383 void test_accept() { |
| 5384 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null); | 5384 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null); |
| 5385 expect(task.accept(new ResolveDartLibraryTaskTestTV_accept()), isTrue); | 5385 expect(task.accept(new ResolveDartLibraryTaskTestTV_accept()), isTrue); |
| 5386 } | 5386 } |
| 5387 void test_getException() { | 5387 void test_getException() { |
| 5388 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null); | 5388 ResolveDartLibraryTask task = new ResolveDartLibraryTask(null, null, null); |
| 5389 expect(task.exception, isNull); | 5389 expect(task.exception, isNull); |
| 5390 } | 5390 } |
| 5391 void test_getLibraryResolver() { | 5391 void test_getLibraryResolver() { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5452 throw exception; | 5452 throw exception; |
| 5453 } | 5453 } |
| 5454 expect(task.libraryResolver, isNotNull); | 5454 expect(task.libraryResolver, isNotNull); |
| 5455 expect(task.librarySource, same(source)); | 5455 expect(task.librarySource, same(source)); |
| 5456 expect(task.unitSource, same(source)); | 5456 expect(task.unitSource, same(source)); |
| 5457 return true; | 5457 return true; |
| 5458 } | 5458 } |
| 5459 } | 5459 } |
| 5460 | 5460 |
| 5461 | 5461 |
| 5462 @ReflectiveTestCase() | 5462 @reflectiveTest |
| 5463 class ResolveDartUnitTaskTest extends EngineTestCase { | 5463 class ResolveDartUnitTaskTest extends EngineTestCase { |
| 5464 void test_accept() { | 5464 void test_accept() { |
| 5465 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); | 5465 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); |
| 5466 expect(task.accept(new ResolveDartUnitTaskTestTV_accept()), isTrue); | 5466 expect(task.accept(new ResolveDartUnitTaskTestTV_accept()), isTrue); |
| 5467 } | 5467 } |
| 5468 | 5468 |
| 5469 void test_getException() { | 5469 void test_getException() { |
| 5470 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); | 5470 ResolveDartUnitTask task = new ResolveDartUnitTask(null, null, null); |
| 5471 expect(task.exception, isNull); | 5471 expect(task.exception, isNull); |
| 5472 } | 5472 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5553 throw exception; | 5553 throw exception; |
| 5554 } | 5554 } |
| 5555 expect(task.librarySource, same(source)); | 5555 expect(task.librarySource, same(source)); |
| 5556 expect(task.resolvedUnit, isNotNull); | 5556 expect(task.resolvedUnit, isNotNull); |
| 5557 expect(task.source, same(source)); | 5557 expect(task.source, same(source)); |
| 5558 return true; | 5558 return true; |
| 5559 } | 5559 } |
| 5560 } | 5560 } |
| 5561 | 5561 |
| 5562 | 5562 |
| 5563 @ReflectiveTestCase() | 5563 @reflectiveTest |
| 5564 class ResolveHtmlTaskTest extends EngineTestCase { | 5564 class ResolveHtmlTaskTest extends EngineTestCase { |
| 5565 void test_accept() { | 5565 void test_accept() { |
| 5566 ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); | 5566 ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); |
| 5567 expect(task.accept(new ResolveHtmlTaskTestTV_accept()), isTrue); | 5567 expect(task.accept(new ResolveHtmlTaskTestTV_accept()), isTrue); |
| 5568 } | 5568 } |
| 5569 | 5569 |
| 5570 void test_getElement() { | 5570 void test_getElement() { |
| 5571 ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); | 5571 ResolveHtmlTask task = new ResolveHtmlTask(null, null, 0, null); |
| 5572 expect(task.element, isNull); | 5572 expect(task.element, isNull); |
| 5573 } | 5573 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5652 } | 5652 } |
| 5653 } | 5653 } |
| 5654 | 5654 |
| 5655 | 5655 |
| 5656 class ResolveHtmlTaskTestTV_perform_valid_2 extends TestTaskVisitor<Object> { | 5656 class ResolveHtmlTaskTestTV_perform_valid_2 extends TestTaskVisitor<Object> { |
| 5657 @override | 5657 @override |
| 5658 Object visitParseHtmlTask(ParseHtmlTask task) => null; | 5658 Object visitParseHtmlTask(ParseHtmlTask task) => null; |
| 5659 } | 5659 } |
| 5660 | 5660 |
| 5661 | 5661 |
| 5662 @ReflectiveTestCase() | 5662 @reflectiveTest |
| 5663 class ScanDartTaskTest extends EngineTestCase { | 5663 class ScanDartTaskTest extends EngineTestCase { |
| 5664 void test_accept() { | 5664 void test_accept() { |
| 5665 ScanDartTask task = new ScanDartTask(null, null, null); | 5665 ScanDartTask task = new ScanDartTask(null, null, null); |
| 5666 expect(task.accept(new ScanDartTaskTestTV_accept()), isTrue); | 5666 expect(task.accept(new ScanDartTaskTestTV_accept()), isTrue); |
| 5667 } | 5667 } |
| 5668 | 5668 |
| 5669 void test_getErrors() { | 5669 void test_getErrors() { |
| 5670 ScanDartTask task = new ScanDartTask(null, null, null); | 5670 ScanDartTask task = new ScanDartTask(null, null, null); |
| 5671 expect(task.errors, hasLength(0)); | 5671 expect(task.errors, hasLength(0)); |
| 5672 } | 5672 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5716 } | 5716 } |
| 5717 expect(task.tokenStream, isNotNull); | 5717 expect(task.tokenStream, isNotNull); |
| 5718 expect(task.errors, hasLength(0)); | 5718 expect(task.errors, hasLength(0)); |
| 5719 expect(task.lineInfo, isNotNull); | 5719 expect(task.lineInfo, isNotNull); |
| 5720 expect(task.source, same(source)); | 5720 expect(task.source, same(source)); |
| 5721 return true; | 5721 return true; |
| 5722 } | 5722 } |
| 5723 } | 5723 } |
| 5724 | 5724 |
| 5725 | 5725 |
| 5726 @ReflectiveTestCase() | 5726 @reflectiveTest |
| 5727 class SdkCachePartitionTest extends EngineTestCase { | 5727 class SdkCachePartitionTest extends EngineTestCase { |
| 5728 void test_contains_false() { | 5728 void test_contains_false() { |
| 5729 SdkCachePartition partition = new SdkCachePartition(null, 8); | 5729 SdkCachePartition partition = new SdkCachePartition(null, 8); |
| 5730 Source source = new TestSource(); | 5730 Source source = new TestSource(); |
| 5731 expect(partition.contains(source), isFalse); | 5731 expect(partition.contains(source), isFalse); |
| 5732 } | 5732 } |
| 5733 | 5733 |
| 5734 void test_contains_true() { | 5734 void test_contains_true() { |
| 5735 SdkCachePartition partition = new SdkCachePartition(null, 8); | 5735 SdkCachePartition partition = new SdkCachePartition(null, 8); |
| 5736 SourceFactory factory = | 5736 SourceFactory factory = |
| 5737 new SourceFactory([new DartUriResolver(DirectoryBasedDartSdk.defaultSdk)
]); | 5737 new SourceFactory([new DartUriResolver(DirectoryBasedDartSdk.defaultSdk)
]); |
| 5738 Source source = factory.forUri("dart:core"); | 5738 Source source = factory.forUri("dart:core"); |
| 5739 expect(partition.contains(source), isTrue); | 5739 expect(partition.contains(source), isTrue); |
| 5740 } | 5740 } |
| 5741 | 5741 |
| 5742 void test_creation() { | 5742 void test_creation() { |
| 5743 expect(new SdkCachePartition(null, 8), isNotNull); | 5743 expect(new SdkCachePartition(null, 8), isNotNull); |
| 5744 } | 5744 } |
| 5745 } | 5745 } |
| 5746 | 5746 |
| 5747 | 5747 |
| 5748 @ReflectiveTestCase() | 5748 @reflectiveTest |
| 5749 class SourcesChangedEventTest { | 5749 class SourcesChangedEventTest { |
| 5750 | 5750 |
| 5751 void test_added() { | 5751 void test_added() { |
| 5752 var source = new StringSource('', '/test.dart'); | 5752 var source = new StringSource('', '/test.dart'); |
| 5753 var changeSet = new ChangeSet(); | 5753 var changeSet = new ChangeSet(); |
| 5754 changeSet.addedSource(source); | 5754 changeSet.addedSource(source); |
| 5755 var event = new SourcesChangedEvent(changeSet); | 5755 var event = new SourcesChangedEvent(changeSet); |
| 5756 assertEvent(event, wereSourcesAdded: true); | 5756 assertEvent(event, wereSourcesAdded: true); |
| 5757 } | 5757 } |
| 5758 | 5758 |
| (...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6852 } | 6852 } |
| 6853 | 6853 |
| 6854 @override | 6854 @override |
| 6855 E visitGenerateDartLintsTask(GenerateDartLintsTask task) { | 6855 E visitGenerateDartLintsTask(GenerateDartLintsTask task) { |
| 6856 fail("Unexpectedly invoked visitGenerateDartLintsTask"); | 6856 fail("Unexpectedly invoked visitGenerateDartLintsTask"); |
| 6857 return null; | 6857 return null; |
| 6858 } | 6858 } |
| 6859 } | 6859 } |
| 6860 | 6860 |
| 6861 | 6861 |
| 6862 @ReflectiveTestCase() | 6862 @reflectiveTest |
| 6863 class UniversalCachePartitionTest extends EngineTestCase { | 6863 class UniversalCachePartitionTest extends EngineTestCase { |
| 6864 void test_contains() { | 6864 void test_contains() { |
| 6865 UniversalCachePartition partition = | 6865 UniversalCachePartition partition = |
| 6866 new UniversalCachePartition(null, 8, null); | 6866 new UniversalCachePartition(null, 8, null); |
| 6867 TestSource source = new TestSource(); | 6867 TestSource source = new TestSource(); |
| 6868 expect(partition.contains(source), isTrue); | 6868 expect(partition.contains(source), isTrue); |
| 6869 } | 6869 } |
| 6870 void test_creation() { | 6870 void test_creation() { |
| 6871 expect(new UniversalCachePartition(null, 8, null), isNotNull); | 6871 expect(new UniversalCachePartition(null, 8, null), isNotNull); |
| 6872 } | 6872 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6942 entryMap.values.forEach((SourceEntry value) { | 6942 entryMap.values.forEach((SourceEntry value) { |
| 6943 if (value.getState(DartEntry.PARSED_UNIT) != CacheState.FLUSHED) { | 6943 if (value.getState(DartEntry.PARSED_UNIT) != CacheState.FLUSHED) { |
| 6944 nonFlushedCount++; | 6944 nonFlushedCount++; |
| 6945 } | 6945 } |
| 6946 }); | 6946 }); |
| 6947 expect(nonFlushedCount, expectedCount); | 6947 expect(nonFlushedCount, expectedCount); |
| 6948 } | 6948 } |
| 6949 } | 6949 } |
| 6950 | 6950 |
| 6951 | 6951 |
| 6952 @ReflectiveTestCase() | 6952 @reflectiveTest |
| 6953 class WorkManagerTest extends EngineTestCase { | 6953 class WorkManagerTest extends EngineTestCase { |
| 6954 void test_addFirst() { | 6954 void test_addFirst() { |
| 6955 TestSource source1 = new TestSource("/f1.dart"); | 6955 TestSource source1 = new TestSource("/f1.dart"); |
| 6956 TestSource source2 = new TestSource("/f2.dart"); | 6956 TestSource source2 = new TestSource("/f2.dart"); |
| 6957 WorkManager manager = new WorkManager(); | 6957 WorkManager manager = new WorkManager(); |
| 6958 manager.add(source1, SourcePriority.UNKNOWN); | 6958 manager.add(source1, SourcePriority.UNKNOWN); |
| 6959 manager.addFirst(source2, SourcePriority.UNKNOWN); | 6959 manager.addFirst(source2, SourcePriority.UNKNOWN); |
| 6960 WorkManager_WorkIterator iterator = manager.iterator(); | 6960 WorkManager_WorkIterator iterator = manager.iterator(); |
| 6961 expect(iterator.next(), same(source2)); | 6961 expect(iterator.next(), same(source2)); |
| 6962 expect(iterator.next(), same(source1)); | 6962 expect(iterator.next(), same(source1)); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7038 bool contains(Source source) => source == libB; | 7038 bool contains(Source source) => source == libB; |
| 7039 } | 7039 } |
| 7040 | 7040 |
| 7041 | 7041 |
| 7042 class _UniversalCachePartitionTest_test_setMaxCacheSize implements | 7042 class _UniversalCachePartitionTest_test_setMaxCacheSize implements |
| 7043 CacheRetentionPolicy { | 7043 CacheRetentionPolicy { |
| 7044 @override | 7044 @override |
| 7045 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => | 7045 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => |
| 7046 RetentionPriority.LOW; | 7046 RetentionPriority.LOW; |
| 7047 } | 7047 } |
| OLD | NEW |