| 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.toplevel; | 5 library test.services.completion.toplevel; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; | 8 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; |
| 9 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; | 9 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; |
| 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| 11 import 'package:analysis_server/src/services/completion/imported_computer.dart'; | 11 import 'package:analysis_server/src/services/completion/imported_computer.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart'; | 12 import 'package:analyzer/src/generated/engine.dart'; |
| 13 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
| 14 | 14 |
| 15 import '../../reflective_tests.dart'; | 15 import '../../reflective_tests.dart'; |
| 16 import 'completion_test_util.dart'; | 16 import 'completion_test_util.dart'; |
| 17 import 'package:analyzer/src/generated/element.dart'; |
| 17 | 18 |
| 18 main() { | 19 main() { |
| 19 groupSep = ' | '; | 20 groupSep = ' | '; |
| 20 runReflectiveTests(ImportedComputerTest); | 21 runReflectiveTests(ImportedComputerTest); |
| 21 } | 22 } |
| 22 | 23 |
| 23 @ReflectiveTestCase() | 24 @ReflectiveTestCase() |
| 24 class ImportedComputerTest extends AbstractSelectorSuggestionTest { | 25 class ImportedComputerTest extends AbstractSelectorSuggestionTest { |
| 25 | 26 |
| 26 void assertCached(String completion) { | 27 void assertCached(String completion) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 107 |
| 107 @override | 108 @override |
| 108 void setUpComputer() { | 109 void setUpComputer() { |
| 109 computer = new ImportedComputer(shouldWaitForLowPrioritySuggestions: true); | 110 computer = new ImportedComputer(shouldWaitForLowPrioritySuggestions: true); |
| 110 } | 111 } |
| 111 | 112 |
| 112 @override | 113 @override |
| 113 test_ArgumentList() { | 114 test_ArgumentList() { |
| 114 return super.test_ArgumentList().then((_) { | 115 return super.test_ArgumentList().then((_) { |
| 115 expect(request.cache.importKey, "import '/libA.dart';"); | 116 expect(request.cache.importKey, "import '/libA.dart';"); |
| 117 ClassElement objClassElem1 = request.cache.importedClassMap['Object']; |
| 118 expect(objClassElem1, isNotNull); |
| 119 ClassElement objClassElem2 = request.cache.objectClassElement; |
| 120 expect(objClassElem1, same(objClassElem2)); |
| 116 }); | 121 }); |
| 117 } | 122 } |
| 118 | 123 |
| 119 @override | 124 @override |
| 120 test_ArgumentList_imported_function() { | 125 test_ArgumentList_imported_function() { |
| 121 return super.test_ArgumentList_imported_function().then((_) { | 126 return super.test_ArgumentList_imported_function().then((_) { |
| 122 expect(request.cache.importKey, "import '/libA.dart';"); | 127 expect(request.cache.importKey, "import '/libA.dart';"); |
| 123 }); | 128 }); |
| 124 } | 129 } |
| 125 | 130 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 (computer as ImportedComputer).shouldWaitForLowPrioritySuggestions = false; | 208 (computer as ImportedComputer).shouldWaitForLowPrioritySuggestions = false; |
| 204 computeFast(); | 209 computeFast(); |
| 205 return computeFull((bool result) { | 210 return computeFull((bool result) { |
| 206 assertSuggestImportedClass('C'); | 211 assertSuggestImportedClass('C'); |
| 207 // Assert computer does not wait for or include low priority results | 212 // Assert computer does not wait for or include low priority results |
| 208 // from non-imported libraries unless instructed to do so. | 213 // from non-imported libraries unless instructed to do so. |
| 209 assertNotSuggested('H'); | 214 assertNotSuggested('H'); |
| 210 }); | 215 }); |
| 211 } | 216 } |
| 212 } | 217 } |
| OLD | NEW |