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

Unified Diff: pkg/analysis_server/test/analysis/notification_implemented_test.dart

Issue 1374943005: Fix for 'implemented' notification after an incremental change. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/analysis/notification_implemented_test.dart
diff --git a/pkg/analysis_server/test/analysis/notification_implemented_test.dart b/pkg/analysis_server/test/analysis/notification_implemented_test.dart
index a26ff5603471288482c86983da1776e425b4796a..6465c3d89a62de7b4b87076a92ffb596e9e73dce 100644
--- a/pkg/analysis_server/test/analysis/notification_implemented_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_implemented_test.dart
@@ -90,16 +90,12 @@ class AnalysisNotificationImplementedTest extends AbstractAnalysisTest {
return createLocalMemoryIndex();
}
+ /**
+ * Subscribe for `IMPLEMENTED` and wait to the notification.
+ */
Future prepareImplementedElements() {
- addAnalysisSubscription(AnalysisService.IMPLEMENTED, testFile);
- Future waitForNotification(int times) {
- if (times == 0 || implementedClasses != null) {
- return new Future.value();
- }
- return new Future.delayed(
- Duration.ZERO, () => waitForNotification(times - 1));
- }
- return waitForNotification(100);
+ subscribeForImplemented();
+ return waitForImplementedElements();
}
void processNotification(Notification notification) {
@@ -117,6 +113,10 @@ class AnalysisNotificationImplementedTest extends AbstractAnalysisTest {
createProject();
}
+ void subscribeForImplemented() {
+ addAnalysisSubscription(AnalysisService.IMPLEMENTED, testFile);
+ }
+
test_afterAnalysis() async {
addTestFile('''
class A {}
@@ -127,6 +127,26 @@ class B extends A {}
assertHasImplementedClass('A {');
}
+ test_afterIncrementalResolution() async {
+ subscribeForImplemented();
+ addTestFile('''
+class A {}
+class B extends A {}
+''');
+ await prepareImplementedElements();
+ assertHasImplementedClass('A {');
+ // add a space
+ implementedClasses = null;
+ server.updateContent('1', {
+ testFile: new AddContentOverlay('''
+class A {}
+class B extends A {}
+''')
+ });
+ await waitForImplementedElements();
+ assertHasImplementedClass('A {');
+ }
+
test_class_extended() async {
addTestFile('''
class A {}
@@ -286,4 +306,15 @@ class B extends A {
await prepareImplementedElements();
assertHasImplementedMember('f(_) {} // A');
}
+
+ Future waitForImplementedElements() {
+ Future waitForNotification(int times) {
+ if (times == 0 || implementedClasses != null) {
+ return new Future.value();
+ }
+ return new Future.delayed(
+ Duration.ZERO, () => waitForNotification(times - 1));
+ }
+ return waitForNotification(100);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698