Chromium Code Reviews| 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 // Dart test program for testing file I/O. | 5 // Dart test program for testing file I/O. |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:collection'; | 9 import 'dart:collection'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1075 | 1075 |
| 1076 static void testLastModified() { | 1076 static void testLastModified() { |
| 1077 asyncTestStarted(); | 1077 asyncTestStarted(); |
| 1078 new File(Platform.executable).lastModified().then((modified) { | 1078 new File(Platform.executable).lastModified().then((modified) { |
| 1079 Expect.isTrue(modified is DateTime); | 1079 Expect.isTrue(modified is DateTime); |
| 1080 Expect.isTrue(modified.isBefore(new DateTime.now())); | 1080 Expect.isTrue(modified.isBefore(new DateTime.now())); |
| 1081 asyncTestDone("testLastModified"); | 1081 asyncTestDone("testLastModified"); |
| 1082 }); | 1082 }); |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 static void testDoubleAsyncRead() { | |
|
Søren Gjesse
2013/09/26 18:31:19
testDoubleAsyncRead -> testDoubleAsyncOperation
Anders Johnsen
2013/10/01 10:50:40
Done.
| |
| 1086 asyncTestStarted(); | |
| 1087 var file = new File(Platform.executable).openSync(); | |
| 1088 Future.wait([file.length(), file.length()]) | |
| 1089 .then((_) { | |
| 1090 Expect.fail("should fail."); | |
| 1091 }, onError: (_) { | |
| 1092 asyncTestDone("testDoubleAsyncRead"); | |
| 1093 }); | |
| 1094 } | |
| 1095 | |
| 1085 static void testLastModifiedSync() { | 1096 static void testLastModifiedSync() { |
| 1086 var modified = new File(Platform.executable).lastModifiedSync(); | 1097 var modified = new File(Platform.executable).lastModifiedSync(); |
| 1087 Expect.isTrue(modified is DateTime); | 1098 Expect.isTrue(modified is DateTime); |
| 1088 Expect.isTrue(modified.isBefore(new DateTime.now())); | 1099 Expect.isTrue(modified.isBefore(new DateTime.now())); |
| 1089 } | 1100 } |
| 1090 | 1101 |
| 1091 // Test that opens the same file for writing then for appending to test | 1102 // Test that opens the same file for writing then for appending to test |
| 1092 // that the file is not truncated when opened for appending. | 1103 // that the file is not truncated when opened for appending. |
| 1093 static void testAppend() { | 1104 static void testAppend() { |
| 1094 asyncTestStarted(); | 1105 asyncTestStarted(); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1293 testOutputStreamWriteAppend(); | 1304 testOutputStreamWriteAppend(); |
| 1294 testOutputStreamWriteString(); | 1305 testOutputStreamWriteString(); |
| 1295 testWriteVariousLists(); | 1306 testWriteVariousLists(); |
| 1296 testDirectory(); | 1307 testDirectory(); |
| 1297 testDirectorySync(); | 1308 testDirectorySync(); |
| 1298 testWriteStringUtf8(); | 1309 testWriteStringUtf8(); |
| 1299 testWriteStringUtf8Sync(); | 1310 testWriteStringUtf8Sync(); |
| 1300 testRename(); | 1311 testRename(); |
| 1301 testRenameSync(); | 1312 testRenameSync(); |
| 1302 testLastModified(); | 1313 testLastModified(); |
| 1314 testDoubleAsyncRead(); | |
| 1303 asyncEnd(); | 1315 asyncEnd(); |
| 1304 }); | 1316 }); |
| 1305 } | 1317 } |
| 1306 } | 1318 } |
| 1307 | 1319 |
| 1308 main() { | 1320 main() { |
| 1309 FileTest.testMain(); | 1321 FileTest.testMain(); |
| 1310 } | 1322 } |
| OLD | NEW |