Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: tests/standalone/io/file_fuzz_test.dart

Issue 10443008: Implement File.lastModified. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Return ms from C Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/socket_impl.dart ('k') | tests/standalone/io/file_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // 'fuzz' test the file APIs by providing unexpected type arguments. The test 5 // 'fuzz' test the file APIs by providing unexpected type arguments. The test
6 // passes if the VM does not crash. 6 // passes if the VM does not crash.
7 7
8 #import('dart:io'); 8 #import('dart:io');
9 #import('dart:isolate'); 9 #import('dart:isolate');
10 10
11 #import('fuzz_support.dart'); 11 #import('fuzz_support.dart');
12 12
13 fuzzSyncMethods() { 13 fuzzSyncMethods() {
14 typeMapping.forEach((k, v) { 14 typeMapping.forEach((k, v) {
15 doItSync(() { 15 doItSync(() {
16 var f = new File(v); 16 var f = new File(v);
17 doItSync(f.existsSync); 17 doItSync(f.existsSync);
18 doItSync(f.createSync); 18 doItSync(f.createSync);
19 doItSync(f.deleteSync); 19 doItSync(f.deleteSync);
20 doItSync(f.directorySync); 20 doItSync(f.directorySync);
21 doItSync(f.lengthSync); 21 doItSync(f.lengthSync);
22 doItSync(f.modifiedSync);
22 doItSync(f.fullPathSync); 23 doItSync(f.fullPathSync);
23 doItSync(() => f.openInputStream().onError = (e) => null); 24 doItSync(() => f.openInputStream().onError = (e) => null);
24 doItSync(f.readAsBytesSync); 25 doItSync(f.readAsBytesSync);
25 doItSync(f.readAsTextSync); 26 doItSync(f.readAsTextSync);
26 doItSync(f.readAsLinesSync); 27 doItSync(f.readAsLinesSync);
27 typeMapping.forEach((k2, v2) { 28 typeMapping.forEach((k2, v2) {
28 doItSync(() => f.openSync(v2)); 29 doItSync(() => f.openSync(v2));
29 doItSync(() => f.openOutputStream(v2).onError = (e) => null); 30 doItSync(() => f.openOutputStream(v2).onError = (e) => null);
30 doItSync(() => f.readAsTextSync(v2)); 31 doItSync(() => f.readAsTextSync(v2));
31 doItSync(() => f.readAsLinesSync(v2)); 32 doItSync(() => f.readAsLinesSync(v2));
32 }); 33 });
33 }); 34 });
34 }); 35 });
35 } 36 }
36 37
37 fuzzAsyncMethods() { 38 fuzzAsyncMethods() {
38 var port = new ReceivePort(); 39 var port = new ReceivePort();
39 var futures = []; 40 var futures = [];
40 typeMapping.forEach((k, v) { 41 typeMapping.forEach((k, v) {
41 doItSync(() { 42 doItSync(() {
42 var f = new File(v); 43 var f = new File(v);
43 futures.add(doItAsync(f.exists)); 44 futures.add(doItAsync(f.exists));
44 futures.add(doItAsync(f.delete)); 45 futures.add(doItAsync(f.delete));
45 futures.add(doItAsync(f.directory)); 46 futures.add(doItAsync(f.directory));
46 futures.add(doItAsync(f.length)); 47 futures.add(doItAsync(f.length));
48 futures.add(doItAsync(f.modified));
47 futures.add(doItAsync(f.open)); 49 futures.add(doItAsync(f.open));
48 futures.add(doItAsync(f.fullPath)); 50 futures.add(doItAsync(f.fullPath));
49 futures.add(doItAsync(f.readAsBytes)); 51 futures.add(doItAsync(f.readAsBytes));
50 futures.add(doItAsync(f.readAsLines)); 52 futures.add(doItAsync(f.readAsLines));
51 futures.add(doItAsync(f.readAsText)); 53 futures.add(doItAsync(f.readAsText));
52 typeMapping.forEach((k2, v2) { 54 typeMapping.forEach((k2, v2) {
53 futures.add(doItAsync(() => f.open(v2))); 55 futures.add(doItAsync(() => f.open(v2)));
54 futures.add(doItAsync(() => f.readAsText(v2))); 56 futures.add(doItAsync(() => f.readAsText(v2)));
55 futures.add(doItAsync(() => f.readAsLines(v2))); 57 futures.add(doItAsync(() => f.readAsLines(v2)));
56 }); 58 });
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 temp.deleteRecursivelySync(); 118 temp.deleteRecursivelySync();
117 }); 119 });
118 } 120 }
119 121
120 main() { 122 main() {
121 fuzzSyncMethods(); 123 fuzzSyncMethods();
122 fuzzAsyncMethods(); 124 fuzzAsyncMethods();
123 fuzzSyncRandomAccessMethods(); 125 fuzzSyncRandomAccessMethods();
124 fuzzAsyncRandomAccessMethods(); 126 fuzzAsyncRandomAccessMethods();
125 } 127 }
OLDNEW
« no previous file with comments | « runtime/bin/socket_impl.dart ('k') | tests/standalone/io/file_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698