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 barback.test.too_many_open_files_test; | 5 library barback.test.too_many_open_files_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:barback/barback.dart'; | 10 import 'package:barback/barback.dart'; |
(...skipping 25 matching lines...) Expand all Loading... |
36 contents.write( | 36 contents.write( |
37 "this is a sixty four character long string that describes itself"); | 37 "this is a sixty four character long string that describes itself"); |
38 } | 38 } |
39 | 39 |
40 new File(filePath).writeAsStringSync(contents.toString()); | 40 new File(filePath).writeAsStringSync(contents.toString()); |
41 | 41 |
42 var id = new AssetId("myapp", "out.txt"); | 42 var id = new AssetId("myapp", "out.txt"); |
43 | 43 |
44 // Create a large number of assets, larger than the file descriptor limit | 44 // Create a large number of assets, larger than the file descriptor limit |
45 // of most machines and start reading from all of them. | 45 // of most machines and start reading from all of them. |
46 var futures = []; | 46 var futures = <Future>[]; |
47 for (var i = 0; i < 1000; i++) { | 47 for (var i = 0; i < 1000; i++) { |
48 var asset = new Asset.fromPath(id, filePath); | 48 var asset = new Asset.fromPath(id, filePath); |
49 futures.add(assetHandler(asset)); | 49 futures.add(assetHandler(asset)); |
50 } | 50 } |
51 | 51 |
52 expect(Future.wait(futures).whenComplete(() { | 52 expect( |
53 new Directory(tempDir).delete(recursive: true); | 53 Future.wait(futures).whenComplete(() { |
54 }), completes); | 54 new Directory(tempDir).delete(recursive: true); |
55 } | 55 }), |
| 56 completes); |
| 57 } |
OLD | NEW |