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

Unified Diff: pkg/analysis_server/test/integration/analysis/navigation_test.dart

Issue 766323002: Compressed/optimized navigation notification. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/integration/analysis/navigation_test.dart
diff --git a/pkg/analysis_server/test/integration/analysis/navigation_test.dart b/pkg/analysis_server/test/integration/analysis/navigation_test.dart
index 22d4130b83d280e13dacfbf511c112d4729f0835..b6609606a3b1e9af0c9226375088872373eb369c 100644
--- a/pkg/analysis_server/test/integration/analysis/navigation_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/navigation_test.dart
@@ -58,20 +58,25 @@ part of foo;
AnalysisService.NAVIGATION: [pathname1]
});
List<NavigationRegion> regions;
+ List<NavigationTarget> targets;
+ List<String> targetFiles;
onAnalysisNavigation.listen((AnalysisNavigationParams params) {
expect(params.file, equals(pathname1));
regions = params.regions;
+ targets = params.targets;
+ targetFiles = params.targetFiles;
});
return analysisFinished.then((_) {
// There should be a single error, due to the fact that 'dart:async' is
// not used.
expect(currentAnalysisErrors[pathname1], hasLength(1));
expect(currentAnalysisErrors[pathname2], isEmpty);
- Element findTargetElement(int index) {
+ NavigationTarget findTargetElement(int index) {
for (NavigationRegion region in regions) {
if (region.offset <= index && index < region.offset + region.length) {
- expect(region.targets, hasLength(1));
- return region.targets[0];
+ expect(region.targetIndexes, hasLength(1));
+ int targetIndex = region.targetIndexes[0];
+ return targets[targetIndex];
}
}
fail('No element found for index $index');
@@ -81,16 +86,16 @@ part of foo;
ElementKind expectedKind) {
int sourceIndex = text1.indexOf(source);
int targetIndex = text1.indexOf(expectedTarget);
- Element element = findTargetElement(sourceIndex);
- expect(element.location.file, equals(pathname1));
- expect(element.location.offset, equals(targetIndex));
+ NavigationTarget element = findTargetElement(sourceIndex);
+ expect(targetFiles[element.fileIndex], equals(pathname1));
+ expect(element.offset, equals(targetIndex));
expect(element.kind, equals(expectedKind));
}
void checkRemote(String source, String expectedTargetRegexp,
ElementKind expectedKind) {
int sourceIndex = text1.indexOf(source);
- Element element = findTargetElement(sourceIndex);
- expect(element.location.file, matches(expectedTargetRegexp));
+ NavigationTarget element = findTargetElement(sourceIndex);
+ expect(targetFiles[element.fileIndex], matches(expectedTargetRegexp));
expect(element.kind, equals(expectedKind));
}
// TODO(paulberry): will the element type 'CLASS_TYPE_ALIAS' ever appear

Powered by Google App Engine
This is Rietveld 408576698