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

Unified Diff: pkg/analysis_server/test/search/top_level_declarations_test.dart

Issue 894323003: Wait for analysis in search domain. Rewrite with async/await. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/search/top_level_declarations_test.dart
diff --git a/pkg/analysis_server/test/search/top_level_declarations_test.dart b/pkg/analysis_server/test/search/top_level_declarations_test.dart
index 26ec55ac5e0a1706e61502453b4922e8784362fd..a2d4cf0c67ff0911cad7138087579d5f65d72607 100644
--- a/pkg/analysis_server/test/search/top_level_declarations_test.dart
+++ b/pkg/analysis_server/test/search/top_level_declarations_test.dart
@@ -35,16 +35,14 @@ class TopLevelDeclarationsTest extends AbstractSearchDomainTest {
}
}
- Future findTopLevelDeclarations(String pattern) {
- return waitForTasksFinished().then((_) {
- Request request =
- new SearchFindTopLevelDeclarationsParams(pattern).toRequest('0');
- Response response = handleSuccessfulRequest(request);
- searchId =
- new SearchFindTopLevelDeclarationsResult.fromResponse(response).id;
- results.clear();
- return waitForSearchResults();
- });
+ Future findTopLevelDeclarations(String pattern) async {
+ await waitForTasksFinished();
+ Request request =
+ new SearchFindTopLevelDeclarationsParams(pattern).toRequest('0');
+ Response response = await waitResponse(request);
+ searchId =
+ new SearchFindTopLevelDeclarationsResult.fromResponse(response).id;
+ return waitForSearchResults();
}
SearchResult findTopLevelResult(ElementKind kind, String name) {
@@ -57,7 +55,7 @@ class TopLevelDeclarationsTest extends AbstractSearchDomainTest {
return null;
}
- test_startEndPattern() {
+ test_startEndPattern() async {
addTestFile('''
class A {} // A
class B = Object with A;
@@ -66,13 +64,12 @@ D() {}
var E = null;
class ABC {}
''');
- return findTopLevelDeclarations('^[A-E]\$').then((_) {
- assertHasDeclaration(ElementKind.CLASS, 'A');
- assertHasDeclaration(ElementKind.CLASS, 'B');
- assertHasDeclaration(ElementKind.FUNCTION_TYPE_ALIAS, 'C');
- assertHasDeclaration(ElementKind.FUNCTION, 'D');
- assertHasDeclaration(ElementKind.TOP_LEVEL_VARIABLE, 'E');
- assertNoDeclaration(ElementKind.CLASS, 'ABC');
- });
+ await findTopLevelDeclarations('^[A-E]\$');
+ assertHasDeclaration(ElementKind.CLASS, 'A');
+ assertHasDeclaration(ElementKind.CLASS, 'B');
+ assertHasDeclaration(ElementKind.FUNCTION_TYPE_ALIAS, 'C');
+ assertHasDeclaration(ElementKind.FUNCTION, 'D');
+ assertHasDeclaration(ElementKind.TOP_LEVEL_VARIABLE, 'E');
+ assertNoDeclaration(ElementKind.CLASS, 'ABC');
}
}

Powered by Google App Engine
This is Rietveld 408576698