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

Side by Side Diff: tests/standalone/src/FileTest.dart

Issue 9488004: Fix FileTest that could delete file before a stream on it was closed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 | « no previous file | no next file » | 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 // Dart test program for testing file I/O. 5 // Dart test program for testing file I/O.
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 #import("dart:isolate"); 8 #import("dart:isolate");
9 9
10 class MyListOfOneElement implements List { 10 class MyListOfOneElement implements List {
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 List<int> buffer = new List<int>(42); 764 List<int> buffer = new List<int>(42);
765 File file = new File(tempDirectory.path + "/out_close_exception_stream"); 765 File file = new File(tempDirectory.path + "/out_close_exception_stream");
766 file.createSync(); 766 file.createSync();
767 InputStream input = file.openInputStreamSync(); 767 InputStream input = file.openInputStreamSync();
768 input.closeHandler = () { 768 input.closeHandler = () {
769 Expect.isTrue(input.closed); 769 Expect.isTrue(input.closed);
770 Expect.isNull(input.readInto(buffer, 0, 12)); 770 Expect.isNull(input.readInto(buffer, 0, 12));
771 OutputStream output = file.openOutputStreamSync(); 771 OutputStream output = file.openOutputStreamSync();
772 output.close(); 772 output.close();
773 Expect.throws(() => output.writeFrom(buffer, 0, 12)); 773 Expect.throws(() => output.writeFrom(buffer, 0, 12));
774 file.deleteSync(); 774 output.closeHandler = () {
775 asyncTestDone("testCloseExceptionStream"); 775 file.deleteSync();
776 asyncTestDone("testCloseExceptionStream");
777 };
776 }; 778 };
777 } 779 }
778 780
779 // Tests buffer out of bounds exception. 781 // Tests buffer out of bounds exception.
780 static void testBufferOutOfBoundsException() { 782 static void testBufferOutOfBoundsException() {
781 bool exceptionCaught = false; 783 bool exceptionCaught = false;
782 bool wrongExceptionCaught = false; 784 bool wrongExceptionCaught = false;
783 File file = new File(tempDirectory.path + "/out_buffer_out_of_bounds"); 785 File file = new File(tempDirectory.path + "/out_buffer_out_of_bounds");
784 RandomAccessFile openedFile = file.openSync(FileMode.WRITE); 786 RandomAccessFile openedFile = file.openSync(FileMode.WRITE);
785 try { 787 try {
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 testWriteVariousLists(); 1146 testWriteVariousLists();
1145 testDirectory(); 1147 testDirectory();
1146 testDirectorySync(); 1148 testDirectorySync();
1147 }); 1149 });
1148 } 1150 }
1149 } 1151 }
1150 1152
1151 main() { 1153 main() {
1152 FileTest.testMain(); 1154 FileTest.testMain();
1153 } 1155 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698