| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 522 |
| 523 Future test_unknownRequest() { | 523 Future test_unknownRequest() { |
| 524 server.handlers = [new EchoHandler()]; | 524 server.handlers = [new EchoHandler()]; |
| 525 var request = new Request('my22', 'randomRequest'); | 525 var request = new Request('my22', 'randomRequest'); |
| 526 return channel.sendRequest(request).then((Response response) { | 526 return channel.sendRequest(request).then((Response response) { |
| 527 expect(response.id, equals('my22')); | 527 expect(response.id, equals('my22')); |
| 528 expect(response.error, isNotNull); | 528 expect(response.error, isNotNull); |
| 529 }); | 529 }); |
| 530 } | 530 } |
| 531 | 531 |
| 532 test_watch_modifyFile_hasOverlay() async { | |
| 533 server.serverServices.add(ServerService.STATUS); | |
| 534 // configure the project | |
| 535 String projectPath = '/root'; | |
| 536 String filePath = '/root/test.dart'; | |
| 537 resourceProvider.newFolder(projectPath); | |
| 538 resourceProvider.newFile(filePath, '// 111'); | |
| 539 server.setAnalysisRoots('0', ['/root'], [], {}); | |
| 540 await pumpEventQueue(); | |
| 541 // add overlay | |
| 542 server.updateContent('1', {filePath: new AddContentOverlay('// 222')}); | |
| 543 await pumpEventQueue(); | |
| 544 // update the file | |
| 545 channel.notificationsReceived.clear(); | |
| 546 resourceProvider.modifyFile(filePath, '// 333'); | |
| 547 await pumpEventQueue(); | |
| 548 // the file has an overlay, so the file-system change was ignored | |
| 549 expect(channel.notificationsReceived.any((notification) { | |
| 550 return notification.event == SERVER_STATUS; | |
| 551 }), isFalse); | |
| 552 } | |
| 553 | |
| 554 void _assertContextOfFolder( | 532 void _assertContextOfFolder( |
| 555 AnalysisContext context, String expectedFolderPath) { | 533 AnalysisContext context, String expectedFolderPath) { |
| 556 Folder expectedFolder = resourceProvider.newFolder(expectedFolderPath); | 534 Folder expectedFolder = resourceProvider.newFolder(expectedFolderPath); |
| 557 ContextInfo expectedContextInfo = | 535 ContextInfo expectedContextInfo = |
| 558 (server.contextManager as ContextManagerImpl) | 536 (server.contextManager as ContextManagerImpl) |
| 559 .getContextInfoFor(expectedFolder); | 537 .getContextInfoFor(expectedFolder); |
| 560 expect(expectedContextInfo, isNotNull); | 538 expect(expectedContextInfo, isNotNull); |
| 561 expect(context, same(expectedContextInfo.context)); | 539 expect(context, same(expectedContextInfo.context)); |
| 562 } | 540 } |
| 563 | 541 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 591 _MockServerOperation(this.context); | 569 _MockServerOperation(this.context); |
| 592 | 570 |
| 593 @override | 571 @override |
| 594 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS; | 572 ServerOperationPriority get priority => ServerOperationPriority.ANALYSIS; |
| 595 | 573 |
| 596 @override | 574 @override |
| 597 void perform(AnalysisServer server) { | 575 void perform(AnalysisServer server) { |
| 598 isComplete = true; | 576 isComplete = true; |
| 599 } | 577 } |
| 600 } | 578 } |
| OLD | NEW |