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

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

Issue 9488003: Fix async test that uses temp directories. (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 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 } catch (Exception ex) { 753 } catch (Exception ex) {
754 wrongExceptionCaught = true; 754 wrongExceptionCaught = true;
755 } 755 }
756 Expect.equals(true, exceptionCaught); 756 Expect.equals(true, exceptionCaught);
757 Expect.equals(true, !wrongExceptionCaught); 757 Expect.equals(true, !wrongExceptionCaught);
758 input.deleteSync(); 758 input.deleteSync();
759 } 759 }
760 760
761 // Tests stream exception handling after file was closed. 761 // Tests stream exception handling after file was closed.
762 static void testCloseExceptionStream() { 762 static void testCloseExceptionStream() {
763 asyncTestStarted();
763 List<int> buffer = new List<int>(42); 764 List<int> buffer = new List<int>(42);
764 File file = new File(tempDirectory.path + "/out_close_exception_stream"); 765 File file = new File(tempDirectory.path + "/out_close_exception_stream");
765 file.createSync(); 766 file.createSync();
766 InputStream input = file.openInputStreamSync(); 767 InputStream input = file.openInputStreamSync();
767 input.closeHandler = () { 768 input.closeHandler = () {
768 Expect.isTrue(input.closed); 769 Expect.isTrue(input.closed);
769 Expect.isNull(input.readInto(buffer, 0, 12)); 770 Expect.isNull(input.readInto(buffer, 0, 12));
770 OutputStream output = file.openOutputStreamSync(); 771 OutputStream output = file.openOutputStreamSync();
771 output.close(); 772 output.close();
772 Expect.throws(() => output.writeFrom(buffer, 0, 12)); 773 Expect.throws(() => output.writeFrom(buffer, 0, 12));
773 file.deleteSync(); 774 file.deleteSync();
775 asyncTestDone("testCloseExceptionStream");
774 }; 776 };
775 } 777 }
776 778
777 // Tests buffer out of bounds exception. 779 // Tests buffer out of bounds exception.
778 static void testBufferOutOfBoundsException() { 780 static void testBufferOutOfBoundsException() {
779 bool exceptionCaught = false; 781 bool exceptionCaught = false;
780 bool wrongExceptionCaught = false; 782 bool wrongExceptionCaught = false;
781 File file = new File(tempDirectory.path + "/out_buffer_out_of_bounds"); 783 File file = new File(tempDirectory.path + "/out_buffer_out_of_bounds");
782 RandomAccessFile openedFile = file.openSync(FileMode.WRITE); 784 RandomAccessFile openedFile = file.openSync(FileMode.WRITE);
783 try { 785 try {
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 testWriteVariousLists(); 1144 testWriteVariousLists();
1143 testDirectory(); 1145 testDirectory();
1144 testDirectorySync(); 1146 testDirectorySync();
1145 }); 1147 });
1146 } 1148 }
1147 } 1149 }
1148 1150
1149 main() { 1151 main() {
1150 FileTest.testMain(); 1152 FileTest.testMain();
1151 } 1153 }
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