Chromium Code Reviews| 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'; |
| 11 import 'dart:collection'; | 11 import 'dart:collection'; |
| 12 | 12 |
| 13 import 'package:analyzer/file_system/memory_file_system.dart'; | |
| 13 import 'package:analyzer/src/cancelable_future.dart'; | 14 import 'package:analyzer/src/cancelable_future.dart'; |
| 14 import 'package:analyzer/src/context/cache.dart' show CacheEntry; | 15 import 'package:analyzer/src/context/cache.dart' show CacheEntry; |
| 15 import 'package:analyzer/src/generated/ast.dart'; | 16 import 'package:analyzer/src/generated/ast.dart'; |
| 16 import 'package:analyzer/src/generated/constant.dart'; | 17 import 'package:analyzer/src/generated/constant.dart'; |
| 17 import 'package:analyzer/src/generated/element.dart'; | 18 import 'package:analyzer/src/generated/element.dart'; |
| 18 import 'package:analyzer/src/generated/engine.dart'; | 19 import 'package:analyzer/src/generated/engine.dart'; |
| 19 import 'package:analyzer/src/generated/error.dart'; | 20 import 'package:analyzer/src/generated/error.dart'; |
| 20 import 'package:analyzer/src/generated/html.dart' as ht; | 21 import 'package:analyzer/src/generated/html.dart' as ht; |
| 21 import 'package:analyzer/src/generated/java_core.dart'; | 22 import 'package:analyzer/src/generated/java_core.dart'; |
| 22 import 'package:analyzer/src/generated/java_engine.dart'; | 23 import 'package:analyzer/src/generated/java_engine.dart'; |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 listener.assertEvent(wereSourcesAdded: true); | 441 listener.assertEvent(wereSourcesAdded: true); |
| 441 listener.assertEvent(changedSources: [libA]); | 442 listener.assertEvent(changedSources: [libA]); |
| 442 listener.assertEvent(wereSourcesAdded: true); | 443 listener.assertEvent(wereSourcesAdded: true); |
| 443 listener.assertEvent(changedSources: [libB]); | 444 listener.assertEvent(changedSources: [libB]); |
| 444 listener.assertEvent(changedSources: [libB]); | 445 listener.assertEvent(changedSources: [libB]); |
| 445 listener.assertEvent(wereSourcesRemovedOrDeleted: true); | 446 listener.assertEvent(wereSourcesRemovedOrDeleted: true); |
| 446 listener.assertNoMoreEvents(); | 447 listener.assertNoMoreEvents(); |
| 447 }); | 448 }); |
| 448 } | 449 } |
| 449 | 450 |
| 451 /** | |
| 452 * IDEA uses the following scenarion: | |
|
Brian Wilkerson
2015/07/06 16:14:41
"scenarion" --> "scenario"
| |
| 453 * 1. Add overlay. | |
| 454 * 2. Change overlay. | |
| 455 * 3. If the contents of the document buffer is the same as the contents | |
| 456 * of the file, remove overlay. | |
| 457 * So, we need to try to use incremental resolution for removing overlays too. | |
| 458 */ | |
| 459 void test_applyChanges_remove_incremental() { | |
| 460 MemoryResourceProvider resourceProvider = new MemoryResourceProvider(); | |
| 461 Source source = resourceProvider.newFile('/test.dart', r''' | |
| 462 main() { | |
| 463 print(1); | |
| 464 } | |
| 465 ''').createSource(); | |
| 466 _context = AnalysisContextFactory.oldContextWithCore(); | |
| 467 _context.analysisOptions = new AnalysisOptionsImpl()..incremental = true; | |
| 468 _context.applyChanges(new ChangeSet()..addedSource(source)); | |
| 469 // remember compilation unit | |
| 470 _analyzeAll_assertFinished(); | |
| 471 CompilationUnit unit = _context.getResolvedCompilationUnit2(source, source); | |
| 472 // add overlay | |
| 473 _context.setContents(source, r''' | |
| 474 main() { | |
| 475 print(12); | |
| 476 } | |
| 477 '''); | |
| 478 _analyzeAll_assertFinished(); | |
| 479 expect(_context.getResolvedCompilationUnit2(source, source), unit); | |
| 480 // remove overlay | |
| 481 _context.setContents(source, null); | |
| 482 _analyzeAll_assertFinished(); | |
| 483 expect(_context.getResolvedCompilationUnit2(source, source), unit); | |
| 484 } | |
| 485 | |
| 450 Future test_applyChanges_removeContainer() { | 486 Future test_applyChanges_removeContainer() { |
| 451 _context = AnalysisContextFactory.oldContextWithCore(); | 487 _context = AnalysisContextFactory.oldContextWithCore(); |
| 452 SourcesChangedListener listener = new SourcesChangedListener(); | 488 SourcesChangedListener listener = new SourcesChangedListener(); |
| 453 _context.onSourcesChanged.listen(listener.onData); | 489 _context.onSourcesChanged.listen(listener.onData); |
| 454 _sourceFactory = _context.sourceFactory; | 490 _sourceFactory = _context.sourceFactory; |
| 455 String libAContents = r''' | 491 String libAContents = r''' |
| 456 library libA; | 492 library libA; |
| 457 import 'libB.dart';'''; | 493 import 'libB.dart';'''; |
| 458 Source libA = _addSource("/libA.dart", libAContents); | 494 Source libA = _addSource("/libA.dart", libAContents); |
| 459 String libBContents = "library libB;"; | 495 String libBContents = "library libB;"; |
| (...skipping 6168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6628 @override | 6664 @override |
| 6629 bool exists() => true; | 6665 bool exists() => true; |
| 6630 } | 6666 } |
| 6631 | 6667 |
| 6632 class _UniversalCachePartitionTest_test_setMaxCacheSize | 6668 class _UniversalCachePartitionTest_test_setMaxCacheSize |
| 6633 implements CacheRetentionPolicy { | 6669 implements CacheRetentionPolicy { |
| 6634 @override | 6670 @override |
| 6635 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => | 6671 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) => |
| 6636 RetentionPriority.LOW; | 6672 RetentionPriority.LOW; |
| 6637 } | 6673 } |
| OLD | NEW |