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

Unified Diff: tests/standalone/io/file_test.dart

Issue 24721003: Only allow one async operation on RandomAccessFile at a time. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Also disallow sync calls while an async operation is scheduled. Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/file_test.dart
diff --git a/tests/standalone/io/file_test.dart b/tests/standalone/io/file_test.dart
index 3b8c383469b2f1d29ede4d03f6d3565e0c0ca285..4e3cc3d88948b6da6fc3d10bf0db6d95bf3b50cd 100644
--- a/tests/standalone/io/file_test.dart
+++ b/tests/standalone/io/file_test.dart
@@ -1082,6 +1082,29 @@ class FileTest {
});
}
+ static void testDoubleAsyncOperation() {
+ asyncTestStarted();
+ var file = new File(Platform.executable).openSync();
+ var completer = new Completer();
+ int done = 0;
+ bool error = false;
+ void getLength() {
+ file.length()
+ .catchError((e) { error = true; })
+ .whenComplete(() {
+ if (++done == 2) {
+ asyncTestDone("testDoubleAsyncOperation");
+ Expect.isTrue(error);
+ file.lengthSync();
+ file.closeSync();
+ }
+ });
+ }
+ getLength();
+ getLength();
+ Expect.throws(() => file.lengthSync());
+ }
+
static void testLastModifiedSync() {
var modified = new File(Platform.executable).lastModifiedSync();
Expect.isTrue(modified is DateTime);
@@ -1300,6 +1323,7 @@ class FileTest {
testRename();
testRenameSync();
testLastModified();
+ testDoubleAsyncOperation();
asyncEnd();
});
}
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698