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

Side by Side Diff: pkg/analysis_server/test/domain_analysis_test.dart

Issue 308003009: Add ServerOperation and queue. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove some priorities Created 6 years, 6 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 | Annotate | Revision Log
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.domain.analysis; 5 library test.domain.analysis;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 /** 256 /**
257 * Returns highlights recorded for the given [testFile]. 257 * Returns highlights recorded for the given [testFile].
258 * May be empty, but not `null`. 258 * May be empty, but not `null`.
259 */ 259 */
260 List<Map<String, Object>> getTestHighlights() { 260 List<Map<String, Object>> getTestHighlights() {
261 return getHighlights(testFile); 261 return getHighlights(testFile);
262 } 262 }
263 263
264 /** 264 /**
265 * Creates an empty project `/project/`. 265 * Creates an empty project `/project`.
266 */ 266 */
267 void createEmptyProject() { 267 void createEmptyProject() {
268 resourceProvider.newFolder('/project'); 268 resourceProvider.newFolder('/project');
269 Request request = new Request('0', METHOD_SET_ANALYSIS_ROOTS); 269 Request request = new Request('0', METHOD_SET_ANALYSIS_ROOTS);
270 request.setParameter(INCLUDED, ['/project']); 270 request.setParameter(INCLUDED, ['/project']);
271 request.setParameter(EXCLUDED, []); 271 request.setParameter(EXCLUDED, []);
272 handleSuccessfulRequest(request); 272 handleSuccessfulRequest(request);
273 } 273 }
274 274
275 /** 275 /**
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 Request request = new Request('0', METHOD_UPDATE_CONTENT); 1097 Request request = new Request('0', METHOD_UPDATE_CONTENT);
1098 request.setParameter('files', 1098 request.setParameter('files',
1099 { 1099 {
1100 helper.testFile : { 1100 helper.testFile : {
1101 CONTENT : 'library lib' 1101 CONTENT : 'library lib'
1102 } 1102 }
1103 }); 1103 });
1104 helper.handleSuccessfulRequest(request); 1104 helper.handleSuccessfulRequest(request);
1105 } 1105 }
1106 // wait, there is an error 1106 // wait, there is an error
1107 helper.waitForTasksFinished().then((_) { 1107 return helper.waitForTasksFinished().then((_) {
1108 List<AnalysisError> errors = helper.getTestErrors(); 1108 List<AnalysisError> errors = helper.getTestErrors();
1109 expect(errors, hasLength(1)); 1109 expect(errors, hasLength(1));
1110 }); 1110 });
1111 }); 1111 });
1112 }); 1112 });
1113 1113
1114 test('incremental', () { 1114 test('incremental', () {
1115 AnalysisTestHelper helper = new AnalysisTestHelper(); 1115 AnalysisTestHelper helper = new AnalysisTestHelper();
1116 helper.createSingleFileProject('library A;'); 1116 helper.createSingleFileProject('library A;');
1117 return helper.waitForTasksFinished().then((_) { 1117 return helper.waitForTasksFinished().then((_) {
1118 // no errors initially 1118 // no errors initially
1119 List<AnalysisError> errors = helper.getTestErrors(); 1119 List<AnalysisError> errors = helper.getTestErrors();
1120 expect(errors, isEmpty); 1120 expect(errors, isEmpty);
1121 // update code 1121 // update code
1122 { 1122 {
1123 Request request = new Request('0', METHOD_UPDATE_CONTENT); 1123 Request request = new Request('0', METHOD_UPDATE_CONTENT);
1124 request.setParameter('files', 1124 request.setParameter('files',
1125 { 1125 {
1126 helper.testFile : { 1126 helper.testFile : {
1127 CONTENT : 'library lib', 1127 CONTENT : 'library lib',
1128 OFFSET : 'library '.length, 1128 OFFSET : 'library '.length,
1129 OLD_LENGTH : 'A;'.length, 1129 OLD_LENGTH : 'A;'.length,
1130 NEW_LENGTH : 'lib'.length, 1130 NEW_LENGTH : 'lib'.length,
1131 } 1131 }
1132 }); 1132 });
1133 helper.handleSuccessfulRequest(request); 1133 helper.handleSuccessfulRequest(request);
1134 } 1134 }
1135 // wait, there is an error 1135 // wait, there is an error
1136 helper.waitForTasksFinished().then((_) { 1136 return helper.waitForTasksFinished().then((_) {
1137 List<AnalysisError> errors = helper.getTestErrors(); 1137 List<AnalysisError> errors = helper.getTestErrors();
1138 expect(errors, hasLength(1)); 1138 expect(errors, hasLength(1));
1139 }); 1139 });
1140 }); 1140 });
1141 }); 1141 });
1142 } 1142 }
1143 1143
1144 1144
1145 void test_setSubscriptions() { 1145 void test_setSubscriptions() {
1146 test('before analysis', () { 1146 test('before analysis', () {
(...skipping 20 matching lines...) Expand all
1167 // subscribe 1167 // subscribe
1168 helper.addAnalysisSubscriptionHighlight(helper.testFile); 1168 helper.addAnalysisSubscriptionHighlight(helper.testFile);
1169 // wait, has regions 1169 // wait, has regions
1170 return helper.waitForTasksFinished().then((_) { 1170 return helper.waitForTasksFinished().then((_) {
1171 var highlights = helper.getHighlights(helper.testFile); 1171 var highlights = helper.getHighlights(helper.testFile);
1172 expect(highlights, isNot(isEmpty)); 1172 expect(highlights, isNot(isEmpty));
1173 }); 1173 });
1174 }); 1174 });
1175 }); 1175 });
1176 } 1176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698