Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: pkg/analysis_server/test/analysis/get_errors_test.dart

Issue 1223413003: Hook for overriding the ContextManager and some code clean-up (with more to follow) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.get_errors; 5 library test.analysis.get_errors;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/domain_analysis.dart'; 9 import 'package:analysis_server/src/domain_analysis.dart';
10 import 'package:analysis_server/src/protocol.dart'; 10 import 'package:analysis_server/src/protocol.dart';
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 main() { 92 main() {
93 print(42) 93 print(42)
94 } 94 }
95 '''); 95 ''');
96 // handle the request synchronously 96 // handle the request synchronously
97 Request request = _createGetErrorsRequest(); 97 Request request = _createGetErrorsRequest();
98 server.handleRequest(request); 98 server.handleRequest(request);
99 // remove context, causes sending an "invalid file" error 99 // remove context, causes sending an "invalid file" error
100 { 100 {
101 Folder projectFolder = resourceProvider.getResource(projectPath); 101 Folder projectFolder = resourceProvider.getResource(projectPath);
102 server.contextDirectoryManager.removeContext(projectFolder); 102 server.contextManager.removeContext(projectFolder);
103 } 103 }
104 // wait for an error response 104 // wait for an error response
105 return serverChannel.waitForResponse(request).then((Response response) { 105 return serverChannel.waitForResponse(request).then((Response response) {
106 expect(response.error, isNotNull); 106 expect(response.error, isNotNull);
107 expect(response.error.code, RequestErrorCode.GET_ERRORS_INVALID_FILE); 107 expect(response.error.code, RequestErrorCode.GET_ERRORS_INVALID_FILE);
108 }); 108 });
109 } 109 }
110 110
111 Future _checkInvalid(String file) { 111 Future _checkInvalid(String file) {
112 Request request = _createGetErrorsRequest(); 112 Request request = _createGetErrorsRequest();
113 return serverChannel.sendRequest(request).then((Response response) { 113 return serverChannel.sendRequest(request).then((Response response) {
114 expect(response.error, isNotNull); 114 expect(response.error, isNotNull);
115 expect(response.error.code, RequestErrorCode.GET_ERRORS_INVALID_FILE); 115 expect(response.error.code, RequestErrorCode.GET_ERRORS_INVALID_FILE);
116 }); 116 });
117 } 117 }
118 118
119 Request _createGetErrorsRequest() { 119 Request _createGetErrorsRequest() {
120 return new AnalysisGetErrorsParams(testFile).toRequest(requestId); 120 return new AnalysisGetErrorsParams(testFile).toRequest(requestId);
121 } 121 }
122 122
123 Future<List<AnalysisError>> _getErrors(String file) { 123 Future<List<AnalysisError>> _getErrors(String file) {
124 Request request = _createGetErrorsRequest(); 124 Request request = _createGetErrorsRequest();
125 return serverChannel.sendRequest(request).then((Response response) { 125 return serverChannel.sendRequest(request).then((Response response) {
126 return new AnalysisGetErrorsResult.fromResponse(response).errors; 126 return new AnalysisGetErrorsResult.fromResponse(response).errors;
127 }); 127 });
128 } 128 }
129 } 129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698