Index: pkg/analysis_server/test/analysis/reanalyze_test.dart |
diff --git a/pkg/analysis_server/test/analysis/reanalyze_test.dart b/pkg/analysis_server/test/analysis/reanalyze_test.dart |
index 4b33161cd1f67b8e56205e2cb907033700b69c40..eb0421df327e6898aa2f6c637f27281d8cdbf723 100644 |
--- a/pkg/analysis_server/test/analysis/reanalyze_test.dart |
+++ b/pkg/analysis_server/test/analysis/reanalyze_test.dart |
@@ -2,10 +2,11 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
+import 'dart:async'; |
+ |
import 'package:analysis_server/protocol/protocol.dart'; |
import 'package:analysis_server/protocol/protocol_generated.dart'; |
import 'package:analysis_server/src/constants.dart'; |
-import 'package:analyzer/src/generated/engine.dart'; |
import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
import 'package:test/test.dart'; |
import 'package:test_reflective_loader/test_reflective_loader.dart'; |
@@ -22,39 +23,34 @@ main() { |
class ReanalyzeTest extends AbstractAnalysisTest { |
Map<String, List<AnalysisError>> filesErrors = {}; |
- @override |
- bool get enableNewAnalysisDriver => false; |
+ Completer _resultsAvailable = new Completer(); |
@override |
void processNotification(Notification notification) { |
if (notification.event == ANALYSIS_ERRORS) { |
var decoded = new AnalysisErrorsParams.fromNotification(notification); |
filesErrors[decoded.file] = decoded.errors; |
+ _resultsAvailable.complete(null); |
} |
} |
test_reanalyze() { |
createProject(); |
- List<AnalysisContext> contexts = server.analysisContexts.toList(); |
- expect(contexts, hasLength(1)); |
- AnalysisContext oldContext = contexts[0]; |
- // Reanalyze should cause a brand new context to be built. |
+ Map drivers = server.driverMap; |
+ expect(drivers, hasLength(1)); |
Request request = new Request("0", ANALYSIS_REANALYZE); |
handleSuccessfulRequest(request); |
- contexts = server.analysisContexts.toList(); |
- expect(contexts, hasLength(1)); |
- AnalysisContext newContext = contexts[0]; |
- expect(newContext, isNot(same(oldContext))); |
+ drivers = server.driverMap; |
+ expect(drivers, hasLength(1)); |
} |
test_reanalyze_with_overlay() async { |
createProject(); |
resourceProvider.newFolder(testFolder); |
resourceProvider.newFile(testFile, 'main() {}'); |
- await waitForTasksFinished(); |
// Update the content with an overlay that contains a syntax error. |
server.updateContent('1', {testFile: new AddContentOverlay('main() {')}); |
- await waitForTasksFinished(); |
+ await _resultsAvailable.future; |
// Verify that the syntax error was detected. |
{ |
List<AnalysisError> errors = filesErrors[testFile]; |
@@ -64,8 +60,9 @@ class ReanalyzeTest extends AbstractAnalysisTest { |
// re-analyzed. |
filesErrors.remove(testFile); |
// Reanalyze. |
+ _resultsAvailable = new Completer(); |
server.reanalyze(null); |
- await waitForTasksFinished(); |
+ await _resultsAvailable.future; |
// The file should have been reanalyzed. |
expect(filesErrors, contains(testFile)); |
// Verify that the syntax error is present (this indicates that the |
@@ -78,7 +75,6 @@ class ReanalyzeTest extends AbstractAnalysisTest { |
test_sentToPlugins() async { |
createProject(); |
- await waitForTasksFinished(); |
Request request = new Request("0", ANALYSIS_REANALYZE); |
handleSuccessfulRequest(request); |
// verify |