Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: pkg/analyzer/test/generated/engine_test.dart

Issue 809793002: Improve nomenclature of new AnalysisContext async method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 Future test_getResolvedCompilationUnitFuture() { 1132 Future test_getResolvedCompilationUnitFuture() {
1133 _context = AnalysisContextFactory.contextWithCore(); 1133 _context = AnalysisContextFactory.contextWithCore();
1134 _sourceFactory = _context.sourceFactory; 1134 _sourceFactory = _context.sourceFactory;
1135 Source source = _addSource("/lib.dart", "library lib;"); 1135 Source source = _addSource("/lib.dart", "library lib;");
1136 // Complete all pending analysis tasks and flush the AST so that it won't 1136 // Complete all pending analysis tasks and flush the AST so that it won't
1137 // be available immediately. 1137 // be available immediately.
1138 _performPendingAnalysisTasks(); 1138 _performPendingAnalysisTasks();
1139 DartEntry dartEntry = _context.getReadableSourceEntryOrNull(source); 1139 DartEntry dartEntry = _context.getReadableSourceEntryOrNull(source);
1140 dartEntry.flushAstStructures(); 1140 dartEntry.flushAstStructures();
1141 bool completed = false; 1141 bool completed = false;
1142 _context.getResolvedCompilationUnitFuture( 1142 _context.computeResolvedCompilationUnitAsync(
1143 source, 1143 source,
1144 source).then((CompilationUnit unit) { 1144 source).then((CompilationUnit unit) {
1145 expect(unit, isNotNull); 1145 expect(unit, isNotNull);
1146 completed = true; 1146 completed = true;
1147 }); 1147 });
1148 return pumpEventQueue().then((_) { 1148 return pumpEventQueue().then((_) {
1149 expect(completed, isFalse); 1149 expect(completed, isFalse);
1150 _performPendingAnalysisTasks(); 1150 _performPendingAnalysisTasks();
1151 }).then((_) => pumpEventQueue()).then((_) { 1151 }).then((_) => pumpEventQueue()).then((_) {
1152 expect(completed, isTrue); 1152 expect(completed, isTrue);
1153 }); 1153 });
1154 } 1154 }
1155 1155
1156 Future test_getResolvedCompilationUnitFuture_cancel() { 1156 Future test_getResolvedCompilationUnitFuture_cancel() {
1157 _context = AnalysisContextFactory.contextWithCore(); 1157 _context = AnalysisContextFactory.contextWithCore();
1158 _sourceFactory = _context.sourceFactory; 1158 _sourceFactory = _context.sourceFactory;
1159 Source source = _addSource("/lib.dart", "library lib;"); 1159 Source source = _addSource("/lib.dart", "library lib;");
1160 // Complete all pending analysis tasks and flush the AST so that it won't 1160 // Complete all pending analysis tasks and flush the AST so that it won't
1161 // be available immediately. 1161 // be available immediately.
1162 _performPendingAnalysisTasks(); 1162 _performPendingAnalysisTasks();
1163 DartEntry dartEntry = _context.getReadableSourceEntryOrNull(source); 1163 DartEntry dartEntry = _context.getReadableSourceEntryOrNull(source);
1164 dartEntry.flushAstStructures(); 1164 dartEntry.flushAstStructures();
1165 CancelableFuture<CompilationUnit> future = 1165 CancelableFuture<CompilationUnit> future =
1166 _context.getResolvedCompilationUnitFuture(source, source); 1166 _context.computeResolvedCompilationUnitAsync(source, source);
1167 bool completed = false; 1167 bool completed = false;
1168 future.then((CompilationUnit unit) { 1168 future.then((CompilationUnit unit) {
1169 fail('Future should have been canceled'); 1169 fail('Future should have been canceled');
1170 }, onError: (error) { 1170 }, onError: (error) {
1171 expect(error, new isInstanceOf<FutureCanceledError>()); 1171 expect(error, new isInstanceOf<FutureCanceledError>());
1172 completed = true; 1172 completed = true;
1173 }); 1173 });
1174 expect(completed, isFalse); 1174 expect(completed, isFalse);
1175 expect(_context.pendingFutureSources_forTesting, isNotEmpty); 1175 expect(_context.pendingFutureSources_forTesting, isNotEmpty);
1176 future.cancel(); 1176 future.cancel();
1177 expect(_context.pendingFutureSources_forTesting, isEmpty); 1177 expect(_context.pendingFutureSources_forTesting, isEmpty);
1178 return pumpEventQueue().then((_) { 1178 return pumpEventQueue().then((_) {
1179 expect(completed, isTrue); 1179 expect(completed, isTrue);
1180 expect(_context.pendingFutureSources_forTesting, isEmpty); 1180 expect(_context.pendingFutureSources_forTesting, isEmpty);
1181 }); 1181 });
1182 } 1182 }
1183 1183
1184 Future test_getResolvedCompilationUnitFuture_unrelatedLibrary() { 1184 Future test_getResolvedCompilationUnitFuture_unrelatedLibrary() {
1185 _context = AnalysisContextFactory.contextWithCore(); 1185 _context = AnalysisContextFactory.contextWithCore();
1186 _sourceFactory = _context.sourceFactory; 1186 _sourceFactory = _context.sourceFactory;
1187 Source librarySource = _addSource("/lib.dart", "library lib;"); 1187 Source librarySource = _addSource("/lib.dart", "library lib;");
1188 Source partSource = _addSource("/part.dart", "part of foo;"); 1188 Source partSource = _addSource("/part.dart", "part of foo;");
1189 bool completed = false; 1189 bool completed = false;
1190 _context.getResolvedCompilationUnitFuture( 1190 _context.computeResolvedCompilationUnitAsync(
1191 partSource, 1191 partSource,
1192 librarySource).then((_) { 1192 librarySource).then((_) {
1193 fail('Expected resolution to fail'); 1193 fail('Expected resolution to fail');
1194 }, onError: (e) { 1194 }, onError: (e) {
1195 expect(e, new isInstanceOf<AnalysisNotScheduledError>()); 1195 expect(e, new isInstanceOf<AnalysisNotScheduledError>());
1196 completed = true; 1196 completed = true;
1197 }); 1197 });
1198 return pumpEventQueue().then((_) { 1198 return pumpEventQueue().then((_) {
1199 expect(completed, isFalse); 1199 expect(completed, isFalse);
1200 _performPendingAnalysisTasks(); 1200 _performPendingAnalysisTasks();
(...skipping 4808 matching lines...) Expand 10 before | Expand all | Expand 10 after
6009 LineInfo computeLineInfo(Source source) { 6009 LineInfo computeLineInfo(Source source) {
6010 fail("Unexpected invocation of computeLineInfo"); 6010 fail("Unexpected invocation of computeLineInfo");
6011 return null; 6011 return null;
6012 } 6012 }
6013 @override 6013 @override
6014 CompilationUnit computeResolvableCompilationUnit(Source source) { 6014 CompilationUnit computeResolvableCompilationUnit(Source source) {
6015 fail("Unexpected invocation of computeResolvableCompilationUnit"); 6015 fail("Unexpected invocation of computeResolvableCompilationUnit");
6016 return null; 6016 return null;
6017 } 6017 }
6018 @override 6018 @override
6019 Future<CompilationUnit> computeResolvedCompilationUnitAsync(Source source,
6020 Source librarySource) {
6021 fail("Unexpected invocation of getResolvedCompilationUnitFuture");
6022 return null;
6023 }
6024 @override
6019 void dispose() { 6025 void dispose() {
6020 fail("Unexpected invocation of dispose"); 6026 fail("Unexpected invocation of dispose");
6021 } 6027 }
6022 @override 6028 @override
6023 bool exists(Source source) { 6029 bool exists(Source source) {
6024 fail("Unexpected invocation of exists"); 6030 fail("Unexpected invocation of exists");
6025 return false; 6031 return false;
6026 } 6032 }
6027 @override 6033 @override
6028 AngularApplication getAngularApplicationWithHtml(Source htmlSource) { 6034 AngularApplication getAngularApplicationWithHtml(Source htmlSource) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
6111 fail("Unexpected invocation of getResolvedCompilationUnit"); 6117 fail("Unexpected invocation of getResolvedCompilationUnit");
6112 return null; 6118 return null;
6113 } 6119 }
6114 @override 6120 @override
6115 CompilationUnit getResolvedCompilationUnit2(Source unitSource, 6121 CompilationUnit getResolvedCompilationUnit2(Source unitSource,
6116 Source librarySource) { 6122 Source librarySource) {
6117 fail("Unexpected invocation of getResolvedCompilationUnit"); 6123 fail("Unexpected invocation of getResolvedCompilationUnit");
6118 return null; 6124 return null;
6119 } 6125 }
6120 @override 6126 @override
6121 Future<CompilationUnit> getResolvedCompilationUnitFuture(Source source,
6122 Source librarySource) {
6123 fail("Unexpected invocation of getResolvedCompilationUnitFuture");
6124 return null;
6125 }
6126 @override
6127 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) { 6127 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) {
6128 fail("Unexpected invocation of getResolvedHtmlUnit"); 6128 fail("Unexpected invocation of getResolvedHtmlUnit");
6129 return null; 6129 return null;
6130 } 6130 }
6131 @override 6131 @override
6132 bool isClientLibrary(Source librarySource) { 6132 bool isClientLibrary(Source librarySource) {
6133 fail("Unexpected invocation of isClientLibrary"); 6133 fail("Unexpected invocation of isClientLibrary");
6134 return false; 6134 return false;
6135 } 6135 }
6136 @override 6136 @override
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
7091 bool contains(Source source) => source == libB; 7091 bool contains(Source source) => source == libB;
7092 } 7092 }
7093 7093
7094 7094
7095 class _UniversalCachePartitionTest_test_setMaxCacheSize implements 7095 class _UniversalCachePartitionTest_test_setMaxCacheSize implements
7096 CacheRetentionPolicy { 7096 CacheRetentionPolicy {
7097 @override 7097 @override
7098 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => 7098 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) =>
7099 RetentionPriority.LOW; 7099 RetentionPriority.LOW;
7100 } 7100 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698