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.analysis.set_priority_files; | 5 library test.analysis.set_priority_files; |
6 | 6 |
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
8 import 'package:analysis_server/src/domain_analysis.dart'; | 8 import 'package:analysis_server/src/domain_analysis.dart'; |
9 import 'package:analyzer/src/generated/engine.dart' | 9 import 'package:analyzer/src/generated/engine.dart' |
10 show InternalAnalysisContext; | 10 show InternalAnalysisContext; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 test_fileInSdk() async { | 53 test_fileInSdk() async { |
54 addTestFile(''); | 54 addTestFile(''); |
55 await server.onAnalysisComplete; | 55 await server.onAnalysisComplete; |
56 // set priority files | 56 // set priority files |
57 String filePath = '/lib/convert/convert.dart'; | 57 String filePath = '/lib/convert/convert.dart'; |
58 Response response = await _setPriorityFile(filePath); | 58 Response response = await _setPriorityFile(filePath); |
59 expect(response, isResponseSuccess('0')); | 59 expect(response, isResponseSuccess('0')); |
60 // verify | 60 // verify |
61 InternalAnalysisContext sdkContext = server.defaultSdk.context; | 61 InternalAnalysisContext sdkContext = server.findSdk().context; |
62 List<Source> prioritySources = sdkContext.prioritySources; | 62 List<Source> prioritySources = sdkContext.prioritySources; |
63 expect(prioritySources, hasLength(1)); | 63 expect(prioritySources, hasLength(1)); |
64 expect(prioritySources.first.fullName, filePath); | 64 expect(prioritySources.first.fullName, filePath); |
65 } | 65 } |
66 | 66 |
67 test_fileNotInAnalysisRoot() async { | 67 test_fileNotInAnalysisRoot() async { |
68 String path = '/other/file.dart'; | 68 String path = '/other/file.dart'; |
69 addFile(path, ''); | 69 addFile(path, ''); |
70 Response response = await _setPriorityFile(path); | 70 Response response = await _setPriorityFile(path); |
71 expect(response.error, isNotNull); | 71 expect(response.error, isNotNull); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 expect(response.error, isNotNull); | 123 expect(response.error, isNotNull); |
124 expect(response.error.code, RequestErrorCode.UNANALYZED_PRIORITY_FILES); | 124 expect(response.error.code, RequestErrorCode.UNANALYZED_PRIORITY_FILES); |
125 } | 125 } |
126 | 126 |
127 _setPriorityFile(String file) async { | 127 _setPriorityFile(String file) async { |
128 Request request = | 128 Request request = |
129 new AnalysisSetPriorityFilesParams(<String>[file]).toRequest('0'); | 129 new AnalysisSetPriorityFilesParams(<String>[file]).toRequest('0'); |
130 return await serverChannel.sendRequest(request); | 130 return await serverChannel.sendRequest(request); |
131 } | 131 } |
132 } | 132 } |
OLD | NEW |