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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/protocol/protocol_constants.dart'; |
8 import 'package:analysis_server/protocol/protocol_generated.dart'; | 9 import 'package:analysis_server/protocol/protocol_generated.dart'; |
9 import 'package:analysis_server/src/constants.dart'; | |
10 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
11 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 11 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
12 | 12 |
13 import '../analysis_abstract.dart'; | 13 import '../analysis_abstract.dart'; |
14 import '../mocks.dart'; | 14 import '../mocks.dart'; |
15 | 15 |
16 main() { | 16 main() { |
17 defineReflectiveSuite(() { | 17 defineReflectiveSuite(() { |
18 defineReflectiveTests(AnalysisNotificationAnalyzedFilesTest); | 18 defineReflectiveTests(AnalysisNotificationAnalyzedFilesTest); |
19 }); | 19 }); |
20 } | 20 } |
21 | 21 |
22 @reflectiveTest | 22 @reflectiveTest |
23 class AnalysisNotificationAnalyzedFilesTest extends AbstractAnalysisTest { | 23 class AnalysisNotificationAnalyzedFilesTest extends AbstractAnalysisTest { |
24 List<String> analyzedFiles; | 24 List<String> analyzedFiles; |
25 bool analyzedFilesReceived = false; | 25 bool analyzedFilesReceived = false; |
26 | 26 |
27 void assertHasFile(String filePath) { | 27 void assertHasFile(String filePath) { |
28 expect(analyzedFilesReceived, isTrue); | 28 expect(analyzedFilesReceived, isTrue); |
29 expect(analyzedFiles, contains(filePath)); | 29 expect(analyzedFiles, contains(filePath)); |
30 } | 30 } |
31 | 31 |
32 Future<Null> prepareAnalyzedFiles() async { | 32 Future<Null> prepareAnalyzedFiles() async { |
33 addGeneralAnalysisSubscription(GeneralAnalysisService.ANALYZED_FILES); | 33 addGeneralAnalysisSubscription(GeneralAnalysisService.ANALYZED_FILES); |
34 await pumpEventQueue(); | 34 await pumpEventQueue(); |
35 } | 35 } |
36 | 36 |
37 void processNotification(Notification notification) { | 37 void processNotification(Notification notification) { |
38 if (notification.event == ANALYSIS_ANALYZED_FILES) { | 38 if (notification.event == ANALYSIS_NOTIFICATION_ANALYZED_FILES) { |
39 AnalysisAnalyzedFilesParams params = | 39 AnalysisAnalyzedFilesParams params = |
40 new AnalysisAnalyzedFilesParams.fromNotification(notification); | 40 new AnalysisAnalyzedFilesParams.fromNotification(notification); |
41 analyzedFilesReceived = true; | 41 analyzedFilesReceived = true; |
42 analyzedFiles = params.directories; | 42 analyzedFiles = params.directories; |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 void setUp() { | 46 void setUp() { |
47 generateSummaryFiles = true; | 47 generateSummaryFiles = true; |
48 super.setUp(); | 48 super.setUp(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 analyzedFilesReceived = false; | 105 analyzedFilesReceived = false; |
106 modifyTestFile('import "/foo.dart";'); | 106 modifyTestFile('import "/foo.dart";'); |
107 await prepareAnalyzedFiles(); | 107 await prepareAnalyzedFiles(); |
108 assertHasFile('/foo.dart'); | 108 assertHasFile('/foo.dart'); |
109 } | 109 } |
110 | 110 |
111 void unsubscribeAnalyzedFiles() { | 111 void unsubscribeAnalyzedFiles() { |
112 removeGeneralAnalysisSubscription(GeneralAnalysisService.ANALYZED_FILES); | 112 removeGeneralAnalysisSubscription(GeneralAnalysisService.ANALYZED_FILES); |
113 } | 113 } |
114 } | 114 } |
OLD | NEW |