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

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

Issue 228093003: Make File:openRead always have one outstanding read, when invoking callbacks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | « sdk/lib/io/file_impl.dart ('k') | 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) 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 // Testing file input stream, VM-only, standalone test. 4 // Testing file input stream, VM-only, standalone test.
5 5
6 import "dart:convert"; 6 import "dart:convert";
7 import "dart:io"; 7 import "dart:io";
8 8
9 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 asyncEnd(); 48 asyncEnd();
49 }); 49 });
50 } 50 }
51 51
52 52
53 // Create a file that is big enough that a file stream will 53 // Create a file that is big enough that a file stream will
54 // read it in multiple chunks. 54 // read it in multiple chunks.
55 int writeLongFileSync(File file) { 55 int writeLongFileSync(File file) {
56 file.createSync(); 56 file.createSync();
57 StringBuffer buffer = new StringBuffer(); 57 StringBuffer buffer = new StringBuffer();
58 for (var i = 0; i < 10000; i++) { 58 for (var i = 0; i < 50000; i++) {
59 buffer.write("Hello, world"); 59 buffer.write("Hello, world");
60 } 60 }
61 file.writeAsStringSync(buffer.toString()); 61 file.writeAsStringSync(buffer.toString());
62 var length = file.lengthSync(); 62 var length = file.lengthSync();
63 Expect.equals(buffer.length, length); 63 Expect.equals(buffer.length, length);
64 return length; 64 return length;
65 } 65 }
66 66
67 67
68 void testInputStreamTruncate() { 68 void testInputStreamTruncate() {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 testInputStreamDelete(); 256 testInputStreamDelete();
257 testInputStreamAppend(); 257 testInputStreamAppend();
258 testInputStreamOffset(); 258 testInputStreamOffset();
259 testInputStreamBadOffset(); 259 testInputStreamBadOffset();
260 // Check the length of these files as both are text files where one 260 // Check the length of these files as both are text files where one
261 // is without a terminating line separator which can easily be added 261 // is without a terminating line separator which can easily be added
262 // back if accidentally opened in a text editor. 262 // back if accidentally opened in a text editor.
263 testStringLineSplitterEnding("readline_test1.dat", 111); 263 testStringLineSplitterEnding("readline_test1.dat", 111);
264 testStringLineSplitterEnding("readline_test2.dat", 114); 264 testStringLineSplitterEnding("readline_test2.dat", 114);
265 } 265 }
OLDNEW
« 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