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

Side by Side Diff: pkg/analysis_server/test/integration/analysis/navigation_test.dart

Issue 1266923004: More fixes for failures on the Windows bot (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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
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.integration.analysis.navigation; 5 library test.integration.analysis.navigation;
6 6
7 import 'package:analysis_server/src/protocol.dart'; 7 import 'package:analysis_server/src/protocol.dart';
8 import 'package:test_reflective_loader/test_reflective_loader.dart'; 8 import 'package:test_reflective_loader/test_reflective_loader.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
11 import '../../utils.dart';
11 import '../integration_tests.dart'; 12 import '../integration_tests.dart';
12 13
13 main() { 14 main() {
15 initializeTestEnvironment();
14 defineReflectiveTests(AnalysisNavigationTest); 16 defineReflectiveTests(AnalysisNavigationTest);
15 } 17 }
16 18
17 @reflectiveTest 19 @reflectiveTest
18 class AnalysisNavigationTest extends AbstractAnalysisServerIntegrationTest { 20 class AnalysisNavigationTest extends AbstractAnalysisServerIntegrationTest {
19 test_navigation() { 21 test_navigation() {
20 String pathname1 = sourcePath('test1.dart'); 22 String pathname1 = sourcePath('test1.dart');
21 String text1 = r''' 23 String text1 = r'''
22 library foo; 24 library foo;
23 25
(...skipping 23 matching lines...) Expand all
47 localVariable.field = 1; 49 localVariable.field = 1;
48 } 50 }
49 '''; 51 ''';
50 writeFile(pathname1, text1); 52 writeFile(pathname1, text1);
51 String pathname2 = sourcePath('test2.dart'); 53 String pathname2 = sourcePath('test2.dart');
52 String text2 = r''' 54 String text2 = r'''
53 part of foo; 55 part of foo;
54 '''; 56 ''';
55 writeFile(pathname2, text2); 57 writeFile(pathname2, text2);
56 standardAnalysisSetup(); 58 standardAnalysisSetup();
57 sendAnalysisSetSubscriptions({AnalysisService.NAVIGATION: [pathname1]}); 59 sendAnalysisSetSubscriptions({
60 AnalysisService.NAVIGATION: [pathname1]
61 });
58 List<NavigationRegion> regions; 62 List<NavigationRegion> regions;
59 List<NavigationTarget> targets; 63 List<NavigationTarget> targets;
60 List<String> targetFiles; 64 List<String> targetFiles;
61 onAnalysisNavigation.listen((AnalysisNavigationParams params) { 65 onAnalysisNavigation.listen((AnalysisNavigationParams params) {
62 expect(params.file, equals(pathname1)); 66 expect(params.file, equals(pathname1));
63 regions = params.regions; 67 regions = params.regions;
64 targets = params.targets; 68 targets = params.targets;
65 targetFiles = params.files; 69 targetFiles = params.files;
66 }); 70 });
67 return analysisFinished.then((_) { 71 return analysisFinished.then((_) {
(...skipping 26 matching lines...) Expand all
94 int sourceIndex = text1.indexOf(source); 98 int sourceIndex = text1.indexOf(source);
95 NavigationTarget element = findTargetElement(sourceIndex); 99 NavigationTarget element = findTargetElement(sourceIndex);
96 expect(targetFiles[element.fileIndex], matches(expectedTargetRegexp)); 100 expect(targetFiles[element.fileIndex], matches(expectedTargetRegexp));
97 expect(element.kind, equals(expectedKind)); 101 expect(element.kind, equals(expectedKind));
98 } 102 }
99 // TODO(paulberry): will the element type 'CLASS_TYPE_ALIAS' ever appear 103 // TODO(paulberry): will the element type 'CLASS_TYPE_ALIAS' ever appear
100 // as a navigation target? 104 // as a navigation target?
101 checkLocal('Class<int>', 'Class<TypeParameter>', ElementKind.CLASS); 105 checkLocal('Class<int>', 'Class<TypeParameter>', ElementKind.CLASS);
102 checkRemote( 106 checkRemote(
103 "'test2.dart';", r'test2.dart$', ElementKind.COMPILATION_UNIT); 107 "'test2.dart';", r'test2.dart$', ElementKind.COMPILATION_UNIT);
104 checkLocal('Class<int>.constructor', 108 checkLocal(
109 'Class<int>.constructor',
105 'constructor(); /* constructor declaration */', 110 'constructor(); /* constructor declaration */',
106 ElementKind.CONSTRUCTOR); 111 ElementKind.CONSTRUCTOR);
107 checkLocal('constructor(); // usage', 112 checkLocal(
113 'constructor(); // usage',
108 'constructor(); /* constructor declaration */', 114 'constructor(); /* constructor declaration */',
109 ElementKind.CONSTRUCTOR); 115 ElementKind.CONSTRUCTOR);
110 checkLocal('field;', 'field;', ElementKind.FIELD); 116 checkLocal('field;', 'field;', ElementKind.FIELD);
111 checkLocal('function(() => localVariable.field)', 117 checkLocal('function(() => localVariable.field)',
112 'function(FunctionTypeAlias parameter)', ElementKind.FUNCTION); 118 'function(FunctionTypeAlias parameter)', ElementKind.FUNCTION);
113 checkLocal('FunctionTypeAlias parameter', 'FunctionTypeAlias();', 119 checkLocal('FunctionTypeAlias parameter', 'FunctionTypeAlias();',
114 ElementKind.FUNCTION_TYPE_ALIAS); 120 ElementKind.FUNCTION_TYPE_ALIAS);
115 checkLocal('field)', 'field;', ElementKind.GETTER); 121 checkLocal('field)', 'field;', ElementKind.GETTER);
116 checkRemote("'dart:async'", r'async\.dart$', ElementKind.LIBRARY); 122 checkRemote("'dart:async'", r'async\.dart$', ElementKind.LIBRARY);
117 checkLocal( 123 checkLocal(
118 'localVariable.field', 'localVariable =', ElementKind.LOCAL_VARIABLE); 124 'localVariable.field', 'localVariable =', ElementKind.LOCAL_VARIABLE);
119 checkLocal('method();', 'method() {', ElementKind.METHOD); 125 checkLocal('method();', 'method() {', ElementKind.METHOD);
120 checkLocal('parameter());', 'parameter) {', ElementKind.PARAMETER); 126 checkLocal('parameter());', 'parameter) {', ElementKind.PARAMETER);
121 checkLocal('field = 1', 'field;', ElementKind.SETTER); 127 checkLocal('field = 1', 'field;', ElementKind.SETTER);
122 checkLocal('topLevelVariable;', 'topLevelVariable;', 128 checkLocal('topLevelVariable;', 'topLevelVariable;',
123 ElementKind.TOP_LEVEL_VARIABLE); 129 ElementKind.TOP_LEVEL_VARIABLE);
124 checkLocal( 130 checkLocal(
125 'TypeParameter field;', 'TypeParameter>', ElementKind.TYPE_PARAMETER); 131 'TypeParameter field;', 'TypeParameter>', ElementKind.TYPE_PARAMETER);
126 }); 132 });
127 } 133 }
128 } 134 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698