Chromium Code Reviews| 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); |
| + } |
| } |