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

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

Issue 479683005: Make more use of generated code in analysis server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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.notification.occurrences; 5 library test.domain.analysis.notification.occurrences;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/computer/computer_occurrences.dart';
10 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
11 import 'package:analysis_server/src/protocol.dart'; 10 import 'package:analysis_server/src/protocol.dart';
12 import 'package:analysis_server/src/protocol2.dart' show AnalysisService, 11 import 'package:analysis_server/src/protocol2.dart';
13 ElementKind;
14 import 'package:analysis_testing/reflective_tests.dart'; 12 import 'package:analysis_testing/reflective_tests.dart';
15 import 'package:unittest/unittest.dart'; 13 import 'package:unittest/unittest.dart';
16 14
17 import 'analysis_abstract.dart'; 15 import 'analysis_abstract.dart';
18 16
19 17
20 main() { 18 main() {
21 groupSep = ' | '; 19 groupSep = ' | ';
22 runReflectiveTests(AnalysisNotificationOccurrencesTest); 20 runReflectiveTests(AnalysisNotificationOccurrencesTest);
23 } 21 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 79 }
82 } 80 }
83 81
84 Future prepareOccurrences() { 82 Future prepareOccurrences() {
85 addAnalysisSubscription(AnalysisService.OCCURRENCES, testFile); 83 addAnalysisSubscription(AnalysisService.OCCURRENCES, testFile);
86 return waitForTasksFinished(); 84 return waitForTasksFinished();
87 } 85 }
88 86
89 void processNotification(Notification notification) { 87 void processNotification(Notification notification) {
90 if (notification.event == ANALYSIS_OCCURRENCES) { 88 if (notification.event == ANALYSIS_OCCURRENCES) {
91 String file = notification.getParameter(FILE); 89 var params = new AnalysisOccurrencesParams.fromNotification(notification);
92 if (file == testFile) { 90 if (params.file == testFile) {
93 occurrencesList = <Occurrences>[]; 91 occurrencesList = params.occurrences;
94 List<Map<String, Object>> jsonList =
95 notification.getParameter(OCCURRENCES);
96 for (Map<String, Object> json in jsonList) {
97 occurrencesList.add(new Occurrences.fromJson(json));
98 }
99 } 92 }
100 } 93 }
101 } 94 }
102 95
103 @override 96 @override
104 void setUp() { 97 void setUp() {
105 super.setUp(); 98 super.setUp();
106 createProject(); 99 createProject();
107 } 100 }
108 101
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 addTestFile(''' 249 addTestFile('''
257 void main() { 250 void main() {
258 } 251 }
259 '''); 252 ''');
260 return prepareOccurrences().then((_) { 253 return prepareOccurrences().then((_) {
261 int offset = findOffset('void main()'); 254 int offset = findOffset('void main()');
262 findRegion(offset, 'void'.length, false); 255 findRegion(offset, 'void'.length, false);
263 }); 256 });
264 } 257 }
265 } 258 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698