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

Side by Side Diff: pkg/analysis_server/test/analysis/get_navigation_test.dart

Issue 1243893002: Separate the API's used by ContextManager. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
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.analysis.get_navigation; 5 library test.analysis.get_navigation;
6 6
7 import 'package:analysis_server/src/domain_analysis.dart'; 7 import 'package:analysis_server/src/domain_analysis.dart';
8 import 'package:analysis_server/src/protocol.dart'; 8 import 'package:analysis_server/src/protocol.dart';
9 import 'package:analyzer/file_system/file_system.dart'; 9 import 'package:analyzer/file_system/file_system.dart';
10 import 'package:test_reflective_loader/test_reflective_loader.dart'; 10 import 'package:test_reflective_loader/test_reflective_loader.dart';
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 print(test); 75 print(test);
76 } 76 }
77 '''); 77 ''');
78 // handle the request synchronously 78 // handle the request synchronously
79 Request request = 79 Request request =
80 _createGetNavigationRequest(testFile, testCode.indexOf('test);'), 0); 80 _createGetNavigationRequest(testFile, testCode.indexOf('test);'), 0);
81 server.handleRequest(request); 81 server.handleRequest(request);
82 // remove context, causes sending an "invalid file" error 82 // remove context, causes sending an "invalid file" error
83 { 83 {
84 Folder projectFolder = resourceProvider.getResource(projectPath); 84 Folder projectFolder = resourceProvider.getResource(projectPath);
85 server.contextManager.removeContext(projectFolder); 85 server.contextManager.callbacks.removeContext(projectFolder, <String>[]);
86 } 86 }
87 // wait for an error response 87 // wait for an error response
88 Response response = await serverChannel.waitForResponse(request); 88 Response response = await serverChannel.waitForResponse(request);
89 expect(response.error, isNotNull); 89 expect(response.error, isNotNull);
90 expect(response.error.code, RequestErrorCode.GET_NAVIGATION_INVALID_FILE); 90 expect(response.error.code, RequestErrorCode.GET_NAVIGATION_INVALID_FILE);
91 } 91 }
92 92
93 _checkInvalid(String file, int offset, int length) async { 93 _checkInvalid(String file, int offset, int length) async {
94 Request request = _createGetNavigationRequest(file, offset, length); 94 Request request = _createGetNavigationRequest(file, offset, length);
95 Response response = await serverChannel.sendRequest(request); 95 Response response = await serverChannel.sendRequest(request);
96 expect(response.error, isNotNull); 96 expect(response.error, isNotNull);
97 expect(response.error.code, RequestErrorCode.GET_NAVIGATION_INVALID_FILE); 97 expect(response.error.code, RequestErrorCode.GET_NAVIGATION_INVALID_FILE);
98 } 98 }
99 99
100 Request _createGetNavigationRequest(String file, int offset, int length) { 100 Request _createGetNavigationRequest(String file, int offset, int length) {
101 return new AnalysisGetNavigationParams(file, offset, length) 101 return new AnalysisGetNavigationParams(file, offset, length)
102 .toRequest(requestId); 102 .toRequest(requestId);
103 } 103 }
104 104
105 _getNavigation(String file, int offset, int length) async { 105 _getNavigation(String file, int offset, int length) async {
106 Request request = _createGetNavigationRequest(file, offset, length); 106 Request request = _createGetNavigationRequest(file, offset, length);
107 Response response = await serverChannel.sendRequest(request); 107 Response response = await serverChannel.sendRequest(request);
108 AnalysisGetNavigationResult result = 108 AnalysisGetNavigationResult result =
109 new AnalysisGetNavigationResult.fromResponse(response); 109 new AnalysisGetNavigationResult.fromResponse(response);
110 targetFiles = result.files; 110 targetFiles = result.files;
111 targets = result.targets; 111 targets = result.targets;
112 regions = result.regions; 112 regions = result.regions;
113 } 113 }
114 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698