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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « tests/standalone/io/file_non_ascii_test.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 // Testing file input stream, VM-only, standalone test. 4 // Testing file input stream, VM-only, standalone test.
5 5
6 import "dart:io"; 6 import "dart:io";
7 import "dart:isolate"; 7 import "dart:isolate";
8 8
9 void testOpenOutputStreamSync() { 9 void testOpenOutputStreamSync() {
10 Directory tempDirectory = new Directory('').createTempSync(); 10 Directory tempDirectory = new Directory('').createTempSync();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 file.create().then((ignore) { 48 file.create().then((ignore) {
49 OutputStream stream = file.openOutputStream(); 49 OutputStream stream = file.openOutputStream();
50 final total = 100; 50 final total = 100;
51 var count = 0; 51 var count = 0;
52 stream.onNoPendingWrites = () { 52 stream.onNoPendingWrites = () {
53 stream.write([count++]); 53 stream.write([count++]);
54 if (count == total) { 54 if (count == total) {
55 stream.close(); 55 stream.close();
56 } 56 }
57 stream.onClosed = () { 57 stream.onClosed = () {
58 List buffer = new List<int>(total); 58 List buffer = new List<int>.fixedLength(total);
59 File fileSync = new File(fileName); 59 File fileSync = new File(fileName);
60 var openedFile = fileSync.openSync(); 60 var openedFile = fileSync.openSync();
61 openedFile.readListSync(buffer, 0, total); 61 openedFile.readListSync(buffer, 0, total);
62 for (var i = 0; i < total; i++) { 62 for (var i = 0; i < total; i++) {
63 Expect.equals(i, buffer[i]); 63 Expect.equals(i, buffer[i]);
64 } 64 }
65 openedFile.closeSync(); 65 openedFile.closeSync();
66 fileSync.deleteSync(); 66 fileSync.deleteSync();
67 done.toSendPort().send("done"); 67 done.toSendPort().send("done");
68 }; 68 };
(...skipping 28 matching lines...) Expand all
97 }; 97 };
98 x.close(); 98 x.close();
99 x.onError = (e) => Expect.fail("No error expected"); 99 x.onError = (e) => Expect.fail("No error expected");
100 } 100 }
101 101
102 main() { 102 main() {
103 testOpenOutputStreamSync(); 103 testOpenOutputStreamSync();
104 testOutputStreamNoPendingWrite(); 104 testOutputStreamNoPendingWrite();
105 testOutputStreamFlush(); 105 testOutputStreamFlush();
106 } 106 }
OLDNEW
« no previous file with comments | « tests/standalone/io/file_non_ascii_test.dart ('k') | tests/standalone/io/file_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698