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

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

Issue 1491013002: Analysis request `getReachableSources` (#24893). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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.domain.analysis; 5 library test.domain.analysis;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 serverPlugin, 48 serverPlugin,
49 new AnalysisServerOptions(), 49 new AnalysisServerOptions(),
50 new MockSdk(), 50 new MockSdk(),
51 InstrumentationService.NULL_SERVICE); 51 InstrumentationService.NULL_SERVICE);
52 handler = new AnalysisDomainHandler(server); 52 handler = new AnalysisDomainHandler(server);
53 }); 53 });
54 54
55 group('updateContent', testUpdateContent); 55 group('updateContent', testUpdateContent);
56 56
57 group('AnalysisDomainHandler', () { 57 group('AnalysisDomainHandler', () {
58 test('getReachableSources', () async {
Brian Wilkerson 2015/12/02 01:56:27 Maybe put this in a group? Also test what happens
pquitslund 2015/12/02 16:40:22 Done.
59 String fileA = '/project/a.dart';
60 String fileB = '/project/b.dart';
61 resourceProvider.newFile(fileA, 'import "b.dart";');
62 resourceProvider.newFile(fileB, '');
63
64 server.setAnalysisRoots('0', ['/project/'], [], {});
65
66 await server.onAnalysisComplete;
67
68 var request = new AnalysisGetReachableSourcesParams(fileA).toRequest('0');
69 var response = handler.handleRequest(request);
70
71 var json = response.toJson()[Response.RESULT];
72
73 // Sanity checks.
74 expect(json['sources'], hasLength(6));
75 expect(json['sources']['file:///project/a.dart'],
76 unorderedEquals(['dart:core', 'file:///project/b.dart']));
Brian Wilkerson 2015/12/02 01:56:27 Perhaps verify that b.dart is a key in the map?
pquitslund 2015/12/02 16:40:22 Done.
77 });
78
58 group('setAnalysisRoots', () { 79 group('setAnalysisRoots', () {
59 Response testSetAnalysisRoots( 80 Response testSetAnalysisRoots(
60 List<String> included, List<String> excluded) { 81 List<String> included, List<String> excluded) {
61 Request request = new AnalysisSetAnalysisRootsParams(included, excluded) 82 Request request = new AnalysisSetAnalysisRootsParams(included, excluded)
62 .toRequest('0'); 83 .toRequest('0');
63 return handler.handleRequest(request); 84 return handler.handleRequest(request);
64 } 85 }
65 86
66 group('excluded', () { 87 group('excluded', () {
67 test('excluded folder', () { 88 test('excluded folder', () {
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 test_beforeAnalysis() async { 756 test_beforeAnalysis() async {
736 addTestFile('int V = 42;'); 757 addTestFile('int V = 42;');
737 createProject(); 758 createProject();
738 // subscribe 759 // subscribe
739 addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile); 760 addAnalysisSubscription(AnalysisService.HIGHLIGHTS, testFile);
740 // wait for analysis 761 // wait for analysis
741 await waitForTasksFinished(); 762 await waitForTasksFinished();
742 expect(filesHighlights[testFile], isNotEmpty); 763 expect(filesHighlights[testFile], isNotEmpty);
743 } 764 }
744 } 765 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698