| 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 analyzer.test.file_system.memory_file_system_test; | 5 library analyzer.test.file_system.memory_file_system_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 provider.newFolder(''); | 608 provider.newFolder(''); |
| 609 }, throwsA(new isInstanceOf<ArgumentError>())); | 609 }, throwsA(new isInstanceOf<ArgumentError>())); |
| 610 } | 610 } |
| 611 | 611 |
| 612 void test_newFolder_notAbsolute() { | 612 void test_newFolder_notAbsolute() { |
| 613 expect(() { | 613 expect(() { |
| 614 provider.newFolder('not/absolute'); | 614 provider.newFolder('not/absolute'); |
| 615 }, throwsA(new isInstanceOf<ArgumentError>())); | 615 }, throwsA(new isInstanceOf<ArgumentError>())); |
| 616 } | 616 } |
| 617 | 617 |
| 618 test_getModificationTimes() async { |
| 619 File file = provider.newFile('/test.dart', ''); |
| 620 Source source = file.createSource(); |
| 621 List<int> times = await provider.getModificationTimes([source]); |
| 622 expect(times, [source.modificationStamp]); |
| 623 } |
| 624 |
| 618 test_watch_createFile() { | 625 test_watch_createFile() { |
| 619 String rootPath = '/my/path'; | 626 String rootPath = '/my/path'; |
| 620 provider.newFolder(rootPath); | 627 provider.newFolder(rootPath); |
| 621 return _watchingFolder(rootPath, (changesReceived) { | 628 return _watchingFolder(rootPath, (changesReceived) { |
| 622 expect(changesReceived, hasLength(0)); | 629 expect(changesReceived, hasLength(0)); |
| 623 String path = posix.join(rootPath, 'foo'); | 630 String path = posix.join(rootPath, 'foo'); |
| 624 provider.newFile(path, 'contents'); | 631 provider.newFile(path, 'contents'); |
| 625 return _delayed(() { | 632 return _delayed(() { |
| 626 expect(changesReceived, hasLength(1)); | 633 expect(changesReceived, hasLength(1)); |
| 627 expect(changesReceived[0].type, equals(ChangeType.ADD)); | 634 expect(changesReceived[0].type, equals(ChangeType.ADD)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 return new Future.delayed(Duration.ZERO, computation); | 691 return new Future.delayed(Duration.ZERO, computation); |
| 685 } | 692 } |
| 686 | 693 |
| 687 _watchingFolder(String path, test(List<WatchEvent> changesReceived)) { | 694 _watchingFolder(String path, test(List<WatchEvent> changesReceived)) { |
| 688 Folder folder = provider.getResource(path); | 695 Folder folder = provider.getResource(path); |
| 689 var changesReceived = <WatchEvent>[]; | 696 var changesReceived = <WatchEvent>[]; |
| 690 folder.changes.listen(changesReceived.add); | 697 folder.changes.listen(changesReceived.add); |
| 691 return test(changesReceived); | 698 return test(changesReceived); |
| 692 } | 699 } |
| 693 } | 700 } |
| OLD | NEW |