| 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_server; | 5 library test.analysis_server; |
| 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/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 server.setAnalysisRoots('0', [dirPath], [], {}); | 314 server.setAnalysisRoots('0', [dirPath], [], {}); |
| 315 // get pair | 315 // get pair |
| 316 ContextSourcePair pair = server.getContextSourcePair(filePath); | 316 ContextSourcePair pair = server.getContextSourcePair(filePath); |
| 317 _assertContextOfFolder(pair.context, dirPath); | 317 _assertContextOfFolder(pair.context, dirPath); |
| 318 Source source = pair.source; | 318 Source source = pair.source; |
| 319 expect(source, isNotNull); | 319 expect(source, isNotNull); |
| 320 expect(source.uri.scheme, 'file'); | 320 expect(source.uri.scheme, 'file'); |
| 321 expect(source.fullName, filePath); | 321 expect(source.fullName, filePath); |
| 322 } | 322 } |
| 323 | 323 |
| 324 test_getContextSourcePair_withPackagesFile() { | |
| 325 String dirPath = '/dir'; | |
| 326 String packagesFilePath = dirPath + '/.packages'; | |
| 327 resourceProvider.newFile(packagesFilePath, 'dir:lib/'); | |
| 328 String filePath = dirPath + '/lib/file.dart'; | |
| 329 resourceProvider.newFile(filePath, 'library lib;'); | |
| 330 // create contexts | |
| 331 server.setAnalysisRoots('0', [dirPath], [], {}); | |
| 332 // get pair | |
| 333 ContextSourcePair pair = server.getContextSourcePair(filePath); | |
| 334 _assertContextOfFolder(pair.context, dirPath); | |
| 335 Source source = pair.source; | |
| 336 expect(source, isNotNull); | |
| 337 expect(source.uri.scheme, 'package'); | |
| 338 expect(source.fullName, filePath); | |
| 339 } | |
| 340 | |
| 341 /** | 324 /** |
| 342 * Test that having multiple analysis contexts analyze the same file doesn't | 325 * Test that having multiple analysis contexts analyze the same file doesn't |
| 343 * cause that file to receive duplicate notifications when it's modified. | 326 * cause that file to receive duplicate notifications when it's modified. |
| 344 */ | 327 */ |
| 345 Future test_no_duplicate_notifications() async { | 328 Future test_no_duplicate_notifications() async { |
| 346 // Subscribe to STATUS so we'll know when analysis is done. | 329 // Subscribe to STATUS so we'll know when analysis is done. |
| 347 server.serverServices = [ServerService.STATUS].toSet(); | 330 server.serverServices = [ServerService.STATUS].toSet(); |
| 348 resourceProvider.newFolder('/foo'); | 331 resourceProvider.newFolder('/foo'); |
| 349 resourceProvider.newFolder('/bar'); | 332 resourceProvider.newFolder('/bar'); |
| 350 resourceProvider.newFile('/foo/foo.dart', 'import "../bar/bar.dart";'); | 333 resourceProvider.newFile('/foo/foo.dart', 'import "../bar/bar.dart";'); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 _MockServerOperation(this.context); | 593 _MockServerOperation(this.context); |
| 611 | 594 |
| 612 @override | 595 @override |
| 613 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS; | 596 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS; |
| 614 | 597 |
| 615 @override | 598 @override |
| 616 void perform(AnalysisServer server) { | 599 void perform(AnalysisServer server) { |
| 617 isComplete = true; | 600 isComplete = true; |
| 618 } | 601 } |
| 619 } | 602 } |
| OLD | NEW |