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

Side by Side Diff: pkg/analysis_server/test/analysis_notification_outline_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.outline; 5 library test.domain.analysis.notification.outline;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/computer/computer_outline.dart';
10 import 'package:analysis_server/src/computer/element.dart';
11 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
12 import 'package:analysis_server/src/protocol.dart'; 10 import 'package:analysis_server/src/protocol.dart';
13 import 'package:analysis_server/src/protocol2.dart' show AnalysisService, 11 import 'package:analysis_server/src/protocol2.dart';
14 ElementKind;
15 import 'package:analysis_testing/reflective_tests.dart'; 12 import 'package:analysis_testing/reflective_tests.dart';
16 import 'package:unittest/unittest.dart'; 13 import 'package:unittest/unittest.dart';
17 14
18 import 'analysis_abstract.dart'; 15 import 'analysis_abstract.dart';
19 16
20 17
21 main() { 18 main() {
22 runReflectiveTests(_AnalysisNotificationOutlineTest); 19 runReflectiveTests(_AnalysisNotificationOutlineTest);
23 } 20 }
24 21
25 22
26 @ReflectiveTestCase() 23 @ReflectiveTestCase()
27 class _AnalysisNotificationOutlineTest extends AbstractAnalysisTest { 24 class _AnalysisNotificationOutlineTest extends AbstractAnalysisTest {
28 Outline outline; 25 Outline outline;
29 26
30 Future prepareOutline() { 27 Future prepareOutline() {
31 addAnalysisSubscription(AnalysisService.OUTLINE, testFile); 28 addAnalysisSubscription(AnalysisService.OUTLINE, testFile);
32 return waitForTasksFinished(); 29 return waitForTasksFinished();
33 } 30 }
34 31
35 void processNotification(Notification notification) { 32 void processNotification(Notification notification) {
36 if (notification.event == ANALYSIS_OUTLINE) { 33 if (notification.event == ANALYSIS_OUTLINE) {
37 String file = notification.getParameter(FILE); 34 var params = new AnalysisOutlineParams.fromNotification(notification);
38 if (file == testFile) { 35 if (params.file == testFile) {
39 Map<String, Object> json = notification.getParameter(OUTLINE); 36 outline = params.outline;
40 outline = new Outline.fromJson(json);
41 } 37 }
42 } 38 }
43 } 39 }
44 40
45 @override 41 @override
46 void setUp() { 42 void setUp() {
47 super.setUp(); 43 super.setUp();
48 createProject(); 44 createProject();
49 } 45 }
50 46
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 Location location = element.location; 735 Location location = element.location;
740 expect(location.offset, testCode.indexOf("propB(int v) {}")); 736 expect(location.offset, testCode.indexOf("propB(int v) {}"));
741 expect(location.length, "propB".length); 737 expect(location.length, "propB".length);
742 } 738 }
743 expect(element.parameters, "(int v)"); 739 expect(element.parameters, "(int v)");
744 expect(element.returnType, ""); 740 expect(element.returnType, "");
745 } 741 }
746 }); 742 });
747 } 743 }
748 } 744 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698