| 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:analyzer_plugin/protocol/protocol_common.dart'; | 10 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
| 11 import 'package:test/test.dart'; | 11 import 'package:test/test.dart'; |
| 12 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 12 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 13 | 13 |
| 14 import '../analysis_abstract.dart'; | 14 import '../analysis_abstract.dart'; |
| 15 | 15 |
| 16 main() { | 16 main() { |
| 17 defineReflectiveSuite(() { | 17 defineReflectiveSuite(() { |
| 18 defineReflectiveTests(AnalysisNotificationOccurrencesTest); | 18 defineReflectiveTests(AnalysisNotificationOccurrencesTest); |
| 19 }); | 19 }); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 '${occurrencesList.join('\n')}'); | 76 '${occurrencesList.join('\n')}'); |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 Future prepareOccurrences() { | 80 Future prepareOccurrences() { |
| 81 addAnalysisSubscription(AnalysisService.OCCURRENCES, testFile); | 81 addAnalysisSubscription(AnalysisService.OCCURRENCES, testFile); |
| 82 return _resultsAvailable.future; | 82 return _resultsAvailable.future; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void processNotification(Notification notification) { | 85 void processNotification(Notification notification) { |
| 86 if (notification.event == ANALYSIS_OCCURRENCES) { | 86 if (notification.event == ANALYSIS_NOTIFICATION_OCCURRENCES) { |
| 87 var params = new AnalysisOccurrencesParams.fromNotification(notification); | 87 var params = new AnalysisOccurrencesParams.fromNotification(notification); |
| 88 if (params.file == testFile) { | 88 if (params.file == testFile) { |
| 89 occurrencesList = params.occurrences; | 89 occurrencesList = params.occurrences; |
| 90 _resultsAvailable.complete(null); | 90 _resultsAvailable.complete(null); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 @override | 95 @override |
| 96 void setUp() { | 96 void setUp() { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 test_type_void() async { | 248 test_type_void() async { |
| 249 addTestFile(''' | 249 addTestFile(''' |
| 250 void main() { | 250 void main() { |
| 251 } | 251 } |
| 252 '''); | 252 '''); |
| 253 await prepareOccurrences(); | 253 await prepareOccurrences(); |
| 254 int offset = findOffset('void main()'); | 254 int offset = findOffset('void main()'); |
| 255 findRegion(offset, 'void'.length, false); | 255 findRegion(offset, 'void'.length, false); |
| 256 } | 256 } |
| 257 } | 257 } |
| OLD | NEW |