| 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 library test.services.completion.dart.manager; | 5 library test.services.completion.dart.manager; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
| 10 import 'package:analysis_server/src/services/completion/completion_core.dart'; | 10 import 'package:analysis_server/src/services/completion/completion_core.dart'; |
| 11 import 'package:analysis_server/src/services/completion/completion_performance.d
art'; | 11 import 'package:analysis_server/src/services/completion/completion_performance.d
art'; |
| 12 import 'package:analysis_server/src/services/completion/dart/completion_manager.
dart'; | 12 import 'package:analysis_server/src/services/completion/dart/completion_manager.
dart'; |
| 13 import 'package:analysis_server/src/services/completion/dart/imported_reference_
contributor.dart'; | 13 import 'package:analysis_server/src/services/completion/dart/imported_reference_
contributor.dart'; |
| 14 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | |
| 15 import 'package:analyzer/dart/element/element.dart'; | 14 import 'package:analyzer/dart/element/element.dart'; |
| 16 import 'package:analyzer/src/task/dart.dart'; | 15 import 'package:analyzer/src/task/dart.dart'; |
| 17 import 'package:test/test.dart'; | 16 import 'package:test/test.dart'; |
| 18 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 17 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 19 | 18 |
| 20 import 'completion_contributor_util.dart'; | 19 import 'completion_contributor_util.dart'; |
| 21 | 20 |
| 22 main() { | 21 main() { |
| 23 defineReflectiveSuite(() { | 22 defineReflectiveSuite(() { |
| 24 defineReflectiveTests(CompletionManagerTest); | 23 defineReflectiveTests(CompletionManagerTest); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 45 '''); | 44 '''); |
| 46 var libSource = addSource( | 45 var libSource = addSource( |
| 47 '/libB.dart', | 46 '/libB.dart', |
| 48 ''' | 47 ''' |
| 49 library libB; | 48 library libB; |
| 50 import "/libA.dart" as foo; | 49 import "/libA.dart" as foo; |
| 51 part '$testFile'; | 50 part '$testFile'; |
| 52 '''); | 51 '''); |
| 53 addTestSource('part of libB; main() {^}'); | 52 addTestSource('part of libB; main() {^}'); |
| 54 | 53 |
| 55 // Associate part with library | |
| 56 if (!enableNewAnalysisDriver) { | |
| 57 context.computeResult(libSource, LIBRARY_CYCLE_UNITS); | |
| 58 } | |
| 59 | |
| 60 // Build the request | 54 // Build the request |
| 61 CompletionRequestImpl baseRequest = new CompletionRequestImpl( | 55 CompletionRequestImpl baseRequest = new CompletionRequestImpl( |
| 62 enableNewAnalysisDriver ? await driver.getResult(testFile) : null, | 56 await driver.getResult(testFile), |
| 63 enableNewAnalysisDriver ? null : context, | |
| 64 provider, | 57 provider, |
| 65 testSource, | 58 testSource, |
| 66 completionOffset, | 59 completionOffset, |
| 67 new CompletionPerformance(), | 60 new CompletionPerformance(), |
| 68 null); | 61 null); |
| 69 Completer<DartCompletionRequest> requestCompleter = | 62 Completer<DartCompletionRequest> requestCompleter = |
| 70 new Completer<DartCompletionRequest>(); | 63 new Completer<DartCompletionRequest>(); |
| 71 DartCompletionRequestImpl | 64 DartCompletionRequestImpl |
| 72 .from(baseRequest, resultDescriptor: RESOLVED_UNIT1) | 65 .from(baseRequest, resultDescriptor: RESOLVED_UNIT1) |
| 73 .then((DartCompletionRequest request) { | 66 .then((DartCompletionRequest request) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 90 void assertImportedLib(String expectedUri) { | 83 void assertImportedLib(String expectedUri) { |
| 91 ImportElement importElem = importNamed(expectedUri); | 84 ImportElement importElem = importNamed(expectedUri); |
| 92 expect(importElem.importedLibrary.exportNamespace, isNotNull); | 85 expect(importElem.importedLibrary.exportNamespace, isNotNull); |
| 93 } | 86 } |
| 94 | 87 |
| 95 // Assert that the new imports each have an export namespace | 88 // Assert that the new imports each have an export namespace |
| 96 assertImportedLib(null /* dart:core */); | 89 assertImportedLib(null /* dart:core */); |
| 97 assertImportedLib('/libA.dart'); | 90 assertImportedLib('/libA.dart'); |
| 98 } | 91 } |
| 99 } | 92 } |
| OLD | NEW |