| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 test.src.task.dart_work_manager_test; | 5 library test.src.task.dart_work_manager_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/context/cache.dart'; | 7 import 'package:analyzer/src/context/cache.dart'; |
| 8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart' | 9 import 'package:analyzer/src/generated/engine.dart' |
| 10 show | 10 show |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 } | 354 } |
| 355 | 355 |
| 356 void test_resultsComputed_notDart() { | 356 void test_resultsComputed_notDart() { |
| 357 manager.unknownSourceQueue.addAll([source1, source2]); | 357 manager.unknownSourceQueue.addAll([source1, source2]); |
| 358 manager.resultsComputed(new TestSource('test.html'), {}); | 358 manager.resultsComputed(new TestSource('test.html'), {}); |
| 359 expect_librarySourceQueue([]); | 359 expect_librarySourceQueue([]); |
| 360 expect_unknownSourceQueue([source1, source2]); | 360 expect_unknownSourceQueue([source1, source2]); |
| 361 } | 361 } |
| 362 | 362 |
| 363 void test_resultsComputed_parsedUnit() { | 363 void test_resultsComputed_parsedUnit() { |
| 364 when(context.getLibrariesContaining(source1)).thenReturn([]); |
| 365 LineInfo lineInfo = new LineInfo([0]); |
| 366 entry1.setValue(LINE_INFO, lineInfo, []); |
| 364 CompilationUnit unit = AstFactory.compilationUnit(); | 367 CompilationUnit unit = AstFactory.compilationUnit(); |
| 365 manager.resultsComputed(source1, {PARSED_UNIT: unit}); | 368 manager.resultsComputed(source1, {PARSED_UNIT: unit}); |
| 366 ChangeNoticeImpl notice = context.getNotice(source1); | 369 ChangeNoticeImpl notice = context.getNotice(source1); |
| 367 expect(notice.parsedDartUnit, unit); | 370 expect(notice.parsedDartUnit, unit); |
| 368 expect(notice.resolvedDartUnit, isNull); | 371 expect(notice.resolvedDartUnit, isNull); |
| 372 expect(notice.lineInfo, lineInfo); |
| 369 } | 373 } |
| 370 | 374 |
| 371 void test_resultsComputed_resolvedUnit() { | 375 void test_resultsComputed_resolvedUnit() { |
| 376 when(context.getLibrariesContaining(source2)).thenReturn([]); |
| 377 LineInfo lineInfo = new LineInfo([0]); |
| 378 entry2.setValue(LINE_INFO, lineInfo, []); |
| 372 CompilationUnit unit = AstFactory.compilationUnit(); | 379 CompilationUnit unit = AstFactory.compilationUnit(); |
| 373 manager.resultsComputed( | 380 manager.resultsComputed( |
| 374 new LibrarySpecificUnit(source1, source2), {RESOLVED_UNIT: unit}); | 381 new LibrarySpecificUnit(source1, source2), {RESOLVED_UNIT: unit}); |
| 375 ChangeNoticeImpl notice = context.getNotice(source2); | 382 ChangeNoticeImpl notice = context.getNotice(source2); |
| 376 expect(notice.parsedDartUnit, isNull); | 383 expect(notice.parsedDartUnit, isNull); |
| 377 expect(notice.resolvedDartUnit, unit); | 384 expect(notice.resolvedDartUnit, unit); |
| 385 expect(notice.lineInfo, lineInfo); |
| 378 } | 386 } |
| 379 | 387 |
| 380 void test_resultsComputed_sourceKind_isLibrary() { | 388 void test_resultsComputed_sourceKind_isLibrary() { |
| 381 manager.unknownSourceQueue.addAll([source1, source2, source3]); | 389 manager.unknownSourceQueue.addAll([source1, source2, source3]); |
| 382 manager.resultsComputed(source2, {SOURCE_KIND: SourceKind.LIBRARY}); | 390 manager.resultsComputed(source2, {SOURCE_KIND: SourceKind.LIBRARY}); |
| 383 expect_librarySourceQueue([source2]); | 391 expect_librarySourceQueue([source2]); |
| 384 expect_unknownSourceQueue([source1, source3]); | 392 expect_unknownSourceQueue([source1, source3]); |
| 385 } | 393 } |
| 386 | 394 |
| 387 void test_resultsComputed_sourceKind_isPart() { | 395 void test_resultsComputed_sourceKind_isPart() { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 414 } | 422 } |
| 415 | 423 |
| 416 @override | 424 @override |
| 417 ChangeNoticeImpl getNotice(Source source) { | 425 ChangeNoticeImpl getNotice(Source source) { |
| 418 return _pendingNotices.putIfAbsent( | 426 return _pendingNotices.putIfAbsent( |
| 419 source, () => new ChangeNoticeImpl(source)); | 427 source, () => new ChangeNoticeImpl(source)); |
| 420 } | 428 } |
| 421 | 429 |
| 422 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 430 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 423 } | 431 } |
| OLD | NEW |