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

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

Issue 1236013003: Fixed bug in implicit analysis notification and renamed tests (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months 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
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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 _context.analysisOptions = options; 238 _context.analysisOptions = options;
239 } 239 }
240 240
241 @override 241 @override
242 void tearDown() { 242 void tearDown() {
243 _context = null; 243 _context = null;
244 _sourceFactory = null; 244 _sourceFactory = null;
245 super.tearDown(); 245 super.tearDown();
246 } 246 }
247 247
248 Future test_analyzedSources_added() async {
249 AnalyzedSourcesListener listener = new AnalyzedSourcesListener();
250 _context.implicitAnalysisEvents.listen(listener.onData);
251 //
252 // Create a file that references an file that is not explicitly being
253 // analyzed and fully analyze it. Ensure that the listener is told about
254 // the implicitly analyzed file.
255 //
256 Source sourceA = _addSource('/a.dart', "library a; import 'b.dart';");
257 Source sourceB = _createSource('/b.dart', "library b;");
258 _context.computeErrors(sourceA);
259 await pumpEventQueue();
260 listener.expectAnalyzed(sourceB);
261 }
262
263 Future test_applyChanges_add() { 248 Future test_applyChanges_add() {
264 SourcesChangedListener listener = new SourcesChangedListener(); 249 SourcesChangedListener listener = new SourcesChangedListener();
265 _context.onSourcesChanged.listen(listener.onData); 250 _context.onSourcesChanged.listen(listener.onData);
266 expect(_context.sourcesNeedingProcessing.isEmpty, isTrue); 251 expect(_context.sourcesNeedingProcessing.isEmpty, isTrue);
267 Source source = 252 Source source =
268 new FileBasedSource(FileUtilities2.createFile("/test.dart")); 253 new FileBasedSource(FileUtilities2.createFile("/test.dart"));
269 ChangeSet changeSet = new ChangeSet(); 254 ChangeSet changeSet = new ChangeSet();
270 changeSet.addedSource(source); 255 changeSet.addedSource(source);
271 _context.applyChanges(changeSet); 256 _context.applyChanges(changeSet);
272 expect(_context.sourcesNeedingProcessing.contains(source), isTrue); 257 expect(_context.sourcesNeedingProcessing.contains(source), isTrue);
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 void test_getStatistics() { 1326 void test_getStatistics() {
1342 AnalysisContextStatistics statistics = _context.statistics; 1327 AnalysisContextStatistics statistics = _context.statistics;
1343 expect(statistics, isNotNull); 1328 expect(statistics, isNotNull);
1344 // The following lines are fragile. 1329 // The following lines are fragile.
1345 // The values depend on the number of libraries in the SDK. 1330 // The values depend on the number of libraries in the SDK.
1346 // assertLength(0, statistics.getCacheRows()); 1331 // assertLength(0, statistics.getCacheRows());
1347 // assertLength(0, statistics.getExceptions()); 1332 // assertLength(0, statistics.getExceptions());
1348 // assertLength(0, statistics.getSources()); 1333 // assertLength(0, statistics.getSources());
1349 } 1334 }
1350 1335
1336 Future test_implicitAnalysisEvents_added() async {
1337 AnalyzedSourcesListener listener = new AnalyzedSourcesListener();
1338 _context.implicitAnalysisEvents.listen(listener.onData);
1339 //
1340 // Create a file that references an file that is not explicitly being
1341 // analyzed and fully analyze it. Ensure that the listener is told about
1342 // the implicitly analyzed file.
1343 //
1344 Source sourceA = _addSource('/a.dart', "library a; import 'b.dart';");
1345 Source sourceB = _createSource('/b.dart', "library b;");
1346 _context.computeErrors(sourceA);
1347 await pumpEventQueue();
1348 listener.expectAnalyzed(sourceB);
1349 }
1350
1351 void test_isClientLibrary_dart() { 1351 void test_isClientLibrary_dart() {
1352 _context = AnalysisContextFactory.oldContextWithCore(); 1352 _context = AnalysisContextFactory.oldContextWithCore();
1353 _sourceFactory = _context.sourceFactory; 1353 _sourceFactory = _context.sourceFactory;
1354 Source source = _addSource("/test.dart", r''' 1354 Source source = _addSource("/test.dart", r'''
1355 import 'dart:html'; 1355 import 'dart:html';
1356 1356
1357 main() {}'''); 1357 main() {}''');
1358 expect(_context.isClientLibrary(source), isFalse); 1358 expect(_context.isClientLibrary(source), isFalse);
1359 expect(_context.isServerLibrary(source), isFalse); 1359 expect(_context.isServerLibrary(source), isFalse);
1360 _context.computeLibraryElement(source); 1360 _context.computeLibraryElement(source);
(...skipping 5371 matching lines...) Expand 10 before | Expand all | Expand 10 after
6732 @override 6732 @override
6733 bool exists() => true; 6733 bool exists() => true;
6734 } 6734 }
6735 6735
6736 class _UniversalCachePartitionTest_test_setMaxCacheSize 6736 class _UniversalCachePartitionTest_test_setMaxCacheSize
6737 implements CacheRetentionPolicy { 6737 implements CacheRetentionPolicy {
6738 @override 6738 @override
6739 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => 6739 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) =>
6740 RetentionPriority.LOW; 6740 RetentionPriority.LOW;
6741 } 6741 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698