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

Unified Diff: pkg/analysis_server/test/domain_analysis_test.dart

Issue 2526473003: Make AnalysisSErver APIs to access unit/node/element asynchronous. (Closed)
Patch Set: Created 4 years, 1 month 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/domain_analysis_test.dart
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index 2c2c5fdb4d3a71a5c025d3bc2b2d8839f096d605..9230d23a024f589f57ccf85b60a3d0c7ede5c46c 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -105,7 +105,7 @@ main() {
}
group('excluded', () {
- test('excluded folder', () {
+ test('excluded folder', () async {
String fileA = '/project/aaa/a.dart';
String fileB = '/project/bbb/b.dart';
resourceProvider.newFile(fileA, '// a');
@@ -115,10 +115,9 @@ main() {
expect(response, isResponseSuccess('0'));
// unit "a" is resolved eventually
// unit "b" is not resolved
- return server.onAnalysisComplete.then((_) {
- expect(serverRef.getResolvedCompilationUnit(fileA), isNotNull);
- expect(serverRef.getResolvedCompilationUnit(fileB), isNull);
- });
+ await server.onAnalysisComplete;
+ expect(await serverRef.getResolvedCompilationUnit(fileA), isNotNull);
+ expect(await serverRef.getResolvedCompilationUnit(fileB), isNull);
});
test('not absolute', () async {
@@ -139,7 +138,7 @@ main() {
});
group('included', () {
- test('new folder', () {
+ test('new folder', () async {
String file = '/project/bin/test.dart';
resourceProvider.newFile('/project/pubspec.yaml', 'name: project');
resourceProvider.newFile(file, 'main() {}');
@@ -147,10 +146,9 @@ main() {
var serverRef = server;
expect(response, isResponseSuccess('0'));
// verify that unit is resolved eventually
- return server.onAnalysisComplete.then((_) {
- var unit = serverRef.getResolvedCompilationUnit(file);
- expect(unit, isNotNull);
- });
+ await server.onAnalysisComplete;
+ var unit = await serverRef.getResolvedCompilationUnit(file);
+ expect(unit, isNotNull);
});
test('nonexistent folder', () async {
@@ -162,7 +160,8 @@ main() {
// Non-existence of /project_a should not prevent files in /project_b
// from being analyzed.
await server.onAnalysisComplete;
- expect(serverRef.getResolvedCompilationUnit(fileB), isNotNull);
+ var unit = await serverRef.getResolvedCompilationUnit(fileB);
+ expect(unit, isNotNull);
});
test('not absolute', () async {

Powered by Google App Engine
This is Rietveld 408576698