OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 descriptor_test; | 5 library descriptor_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import '../../../pkg/pathos/lib/path.dart' as path; | 10 import '../../../pkg/pathos/lib/path.dart' as path; |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 sandbox = dir.path; | 904 sandbox = dir.path; |
905 d.defaultRoot = sandbox; | 905 d.defaultRoot = sandbox; |
906 }); | 906 }); |
907 }); | 907 }); |
908 | 908 |
909 currentSchedule.onComplete.schedule(() { | 909 currentSchedule.onComplete.schedule(() { |
910 d.defaultRoot = null; | 910 d.defaultRoot = null; |
911 if (sandbox == null) return; | 911 if (sandbox == null) return; |
912 var oldSandbox = sandbox; | 912 var oldSandbox = sandbox; |
913 sandbox = null; | 913 sandbox = null; |
914 return new Directory(oldSandbox).delete(recursive: true); | 914 return deleteDir(oldSandbox); |
915 }); | 915 }); |
916 } | 916 } |
917 | 917 |
918 Future<List<int>> byteStreamToList(Stream<List<int>> stream) { | 918 Future<List<int>> byteStreamToList(Stream<List<int>> stream) { |
919 return stream.reduce(<int>[], (buffer, chunk) { | 919 return stream.reduce(<int>[], (buffer, chunk) { |
920 buffer.addAll(chunk); | 920 buffer.addAll(chunk); |
921 return buffer; | 921 return buffer; |
922 }); | 922 }); |
923 } | 923 } |
924 | 924 |
925 Future<String> byteStreamToString(Stream<List<int>> stream) => | 925 Future<String> byteStreamToString(Stream<List<int>> stream) => |
926 byteStreamToList(stream).then((bytes) => new String.fromCharCodes(bytes)); | 926 byteStreamToList(stream).then((bytes) => new String.fromCharCodes(bytes)); |
OLD | NEW |