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

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

Issue 332993006: Implemented analysis.setPrioritySource (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/computer/computer_highlights.dart'; 9 import 'package:analysis_server/src/computer/computer_highlights.dart';
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
11 import 'package:analysis_server/src/constants.dart'; 11 import 'package:analysis_server/src/constants.dart';
12 import 'package:analysis_server/src/domain_analysis.dart'; 12 import 'package:analysis_server/src/domain_analysis.dart';
13 import 'package:analysis_server/src/protocol.dart'; 13 import 'package:analysis_server/src/protocol.dart';
14 import 'package:analysis_server/src/resource.dart'; 14 import 'package:analysis_server/src/resource.dart';
15 import 'package:unittest/unittest.dart'; 15 import 'package:unittest/unittest.dart';
16 16
17 import 'mocks.dart'; 17 import 'mocks.dart';
18 18
19 19
20 main() { 20 main() {
21 groupSep = ' | '; 21 groupSep = ' | ';
22 22
23 MockServerChannel serverChannel; 23 MockServerChannel serverChannel;
24 MemoryResourceProvider resourceProvider;
24 AnalysisServer server; 25 AnalysisServer server;
25 AnalysisDomainHandler handler; 26 AnalysisDomainHandler handler;
26 MemoryResourceProvider resourceProvider = new MemoryResourceProvider();
27 27
28 setUp(() { 28 setUp(() {
29 serverChannel = new MockServerChannel(); 29 serverChannel = new MockServerChannel();
30 resourceProvider = new MemoryResourceProvider();
30 server = new AnalysisServer(serverChannel, resourceProvider); 31 server = new AnalysisServer(serverChannel, resourceProvider);
31 server.defaultSdk = new MockSdk(); 32 server.defaultSdk = new MockSdk();
32 handler = new AnalysisDomainHandler(server); 33 handler = new AnalysisDomainHandler(server);
33 }); 34 });
34 35
35 group('notification.errors', testNotificationErrors); 36 group('notification.errors', testNotificationErrors);
36 group('notification.highlights', testNotificationHighlights); 37 group('notification.highlights', testNotificationHighlights);
37 group('notification.navigation', testNotificationNavigation); 38 group('notification.navigation', testNotificationNavigation);
38 group('updateContent', testUpdateContent); 39 group('updateContent', testUpdateContent);
39 group('setSubscriptions', test_setSubscriptions); 40 group('setSubscriptions', test_setSubscriptions);
(...skipping 28 matching lines...) Expand all
68 expect(response, isResponseSuccess('0')); 69 expect(response, isResponseSuccess('0'));
69 // verify that unit is resolved eventually 70 // verify that unit is resolved eventually
70 return waitForServerOperationsPerformed(server).then((_) { 71 return waitForServerOperationsPerformed(server).then((_) {
71 var unit = serverRef.test_getResolvedCompilationUnit('/project/bin/t est.dart'); 72 var unit = serverRef.test_getResolvedCompilationUnit('/project/bin/t est.dart');
72 expect(unit, isNotNull); 73 expect(unit, isNotNull);
73 }); 74 });
74 }); 75 });
75 }); 76 });
76 }); 77 });
77 78
78 test('setPriorityFiles', () { 79 group('setPriorityFiles', () {
79 var request = new Request('0', ANALYSIS_SET_PRIORITY_FILES); 80 test('invalid', () {
80 request.setParameter( 81 var request = new Request('0', ANALYSIS_SET_PRIORITY_FILES);
81 FILES, 82 request.setParameter(
82 ['projectA/aa.dart', 'projectB/ba.dart']); 83 FILES,
83 var response = handler.handleRequest(request); 84 ['/project/lib.dart']);
84 // TODO(scheglov) implement 85 var response = handler.handleRequest(request);
85 expect(response, isNull); 86 expect(response, isResponseFailure('0'));
87 });
88
89 test('valid', () {
90 resourceProvider.newFolder('/project');
91 resourceProvider.newFile('/project/lib.dart', 'library lib;');
92
93 var setRootsRequest = new Request('0', ANALYSIS_SET_ANALYSIS_ROOTS);
94 setRootsRequest.setParameter(INCLUDED, ['/project']);
95 setRootsRequest.setParameter(EXCLUDED, []);
96 var setRootsResponse = handler.handleRequest(setRootsRequest);
97 expect(setRootsResponse, isResponseSuccess('0'));
98
99 var request = new Request('0', ANALYSIS_SET_PRIORITY_FILES);
100 request.setParameter(
101 FILES,
102 ['/project/lib.dart']);
103 var response = handler.handleRequest(request);
104 expect(response, isResponseSuccess('0'));
105 });
86 }); 106 });
Paul Berry 2014/06/16 23:43:16 At a minimum, we should have a test to verify that
Brian Wilkerson 2014/06/17 17:46:16 Agreed.
87 107
88 test('updateOptions', () { 108 test('updateOptions', () {
89 var request = new Request('0', ANALYSIS_UPDATE_OPTIONS); 109 var request = new Request('0', ANALYSIS_UPDATE_OPTIONS);
90 request.setParameter( 110 request.setParameter(
91 OPTIONS, 111 OPTIONS,
92 { 112 {
93 'analyzeAngular' : true, 113 'analyzeAngular' : true,
94 'enableDeferredLoading': true, 114 'enableDeferredLoading': true,
95 'enableEnums': false 115 'enableEnums': false
96 }); 116 });
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 // subscribe 1662 // subscribe
1643 helper.addAnalysisSubscriptionHighlights(helper.testFile); 1663 helper.addAnalysisSubscriptionHighlights(helper.testFile);
1644 // wait, has regions 1664 // wait, has regions
1645 return helper.waitForOperationsFinished().then((_) { 1665 return helper.waitForOperationsFinished().then((_) {
1646 var highlights = helper.getHighlights(helper.testFile); 1666 var highlights = helper.getHighlights(helper.testFile);
1647 expect(highlights, isNot(isEmpty)); 1667 expect(highlights, isNot(isEmpty));
1648 }); 1668 });
1649 }); 1669 });
1650 }); 1670 });
1651 } 1671 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698