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

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: Put new content into 'testCode'. 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/incremental_resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..396fb9f50eb63a844a5a23ebb99f21c9ef85479a 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.
Brian Wilkerson 2015/09/30 18:05:16 nit: "to" --> "for"
+ */
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,25 @@ 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;
+ testCode = '''
+class A {}
+class B extends A {}
+''';
+ server.updateContent('1', {testFile: new AddContentOverlay(testCode)});
+ await waitForImplementedElements();
+ assertHasImplementedClass('A {');
+ }
+
test_class_extended() async {
addTestFile('''
class A {}
@@ -286,4 +305,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);
+ }
}
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/incremental_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698