| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.analysis.notification.analyzedDirectories; | 5 library test.analysis.notification.analyzedDirectories; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 analyzedFilesReceived = true; | 42 analyzedFilesReceived = true; |
| 43 analyzedFiles = params.directories; | 43 analyzedFiles = params.directories; |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 void setUp() { | 47 void setUp() { |
| 48 super.setUp(); | 48 super.setUp(); |
| 49 createProject(); | 49 createProject(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 test_afterAnalysis() { | 52 test_afterAnalysis() async { |
| 53 addTestFile(''' | 53 addTestFile(''' |
| 54 class A {} | 54 class A {} |
| 55 '''); | 55 '''); |
| 56 return waitForTasksFinished().then((_) { | 56 await waitForTasksFinished(); |
| 57 return prepareAnalyzedFiles().then((_) { | 57 await prepareAnalyzedFiles(); |
| 58 assertHasFile(testFile); | 58 assertHasFile(testFile); |
| 59 }); | |
| 60 }); | |
| 61 } | 59 } |
| 62 | 60 |
| 63 test_beforeAnalysis() { | 61 test_beforeAnalysis() async { |
| 64 addTestFile(''' | 62 addTestFile(''' |
| 65 class A {} | 63 class A {} |
| 66 '''); | 64 '''); |
| 67 return prepareAnalyzedFiles().then((_) { | 65 await prepareAnalyzedFiles(); |
| 68 assertHasFile(testFile); | 66 assertHasFile(testFile); |
| 69 }); | |
| 70 } | 67 } |
| 71 | 68 |
| 72 test_insignificant_change() async { | 69 test_insignificant_change() async { |
| 73 // Making a change that doesn't affect the set of reachable files should | 70 // Making a change that doesn't affect the set of reachable files should |
| 74 // not trigger the notification to be re-sent. | 71 // not trigger the notification to be re-sent. |
| 75 addTestFile('class A {}'); | 72 addTestFile('class A {}'); |
| 76 await prepareAnalyzedFiles(); | 73 await prepareAnalyzedFiles(); |
| 77 await waitForTasksFinished(); | 74 await waitForTasksFinished(); |
| 78 expect(analyzedFilesReceived, isTrue); | 75 expect(analyzedFilesReceived, isTrue); |
| 79 analyzedFilesReceived = false; | 76 analyzedFilesReceived = false; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 110 await pumpEventQueue(); | 107 await pumpEventQueue(); |
| 111 await waitForTasksFinished(); | 108 await waitForTasksFinished(); |
| 112 expect(analyzedFilesReceived, isTrue); | 109 expect(analyzedFilesReceived, isTrue); |
| 113 assertHasFile('/foo.dart'); | 110 assertHasFile('/foo.dart'); |
| 114 } | 111 } |
| 115 | 112 |
| 116 void unsubscribeAnalyzedFiles() { | 113 void unsubscribeAnalyzedFiles() { |
| 117 removeGeneralAnalysisSubscription(GeneralAnalysisService.ANALYZED_FILES); | 114 removeGeneralAnalysisSubscription(GeneralAnalysisService.ANALYZED_FILES); |
| 118 } | 115 } |
| 119 } | 116 } |
| OLD | NEW |