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

Unified Diff: tests/standalone/src/FileInputStreamTest.dart

Issue 9487005: Move back to having File.open{Input,Output}Stream return the stream directly. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 | « samples/actors/samples/sssp/sssp-util.dart ('k') | tests/standalone/src/FileOutputStreamTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/FileInputStreamTest.dart
diff --git a/tests/standalone/src/FileInputStreamTest.dart b/tests/standalone/src/FileInputStreamTest.dart
index 433b31649149d2bbbe955413c27fb368bb19759d..6dfd2f5a6445b3bb9e81e32416ea38b66df1c31c 100644
--- a/tests/standalone/src/FileInputStreamTest.dart
+++ b/tests/standalone/src/FileInputStreamTest.dart
@@ -15,7 +15,7 @@ void testStringInputStreamSync() {
String fileName = getFilename("tests/standalone/src/readuntil_test.dat");
// File contains "Hello Dart\nwassup!\n"
File file = new File(fileName);
- StringInputStream x = new StringInputStream(file.openInputStreamSync());
+ StringInputStream x = new StringInputStream(file.openInputStream());
x.lineHandler = () {
// The file input stream is known (for now) to have read the whole
// file when the data handler is called.
@@ -30,7 +30,7 @@ void testInputStreamAsync() {
String fileName = getFilename("tests/standalone/src/readuntil_test.dat");
// File contains "Hello Dart\nwassup!\n"
var expected = "Hello Dart\nwassup!\n".charCodes();
- InputStream x = (new File(fileName)).openInputStreamSync();
+ InputStream x = (new File(fileName)).openInputStream();
var byteCount = 0;
x.dataHandler = () {
Expect.equals(expected[byteCount], x.read(1)[0]);
@@ -47,7 +47,7 @@ void testStringInputStreamAsync(String name, int length) {
// File contains 10 lines.
File file = new File(fileName);
Expect.equals(length, file.openSync().lengthSync());
- StringInputStream x = new StringInputStream(file.openInputStreamSync());
+ StringInputStream x = new StringInputStream(file.openInputStream());
int lineCount = 0;
x.lineHandler = () {
var line = x.readLine();
@@ -71,7 +71,7 @@ void testChunkedInputStream() {
String fileName = getFilename("tests/standalone/src/readuntil_test.dat");
// File contains 19 bytes ("Hello Dart\nwassup!")
File file = new File(fileName);
- ChunkedInputStream x = new ChunkedInputStream(file.openInputStreamSync());
+ ChunkedInputStream x = new ChunkedInputStream(file.openInputStream());
x.chunkSize = 9;
x.dataHandler = () {
List<int> chunk = x.read();
@@ -92,31 +92,6 @@ void testChunkedInputStream() {
}
-void testOpenInputStreamAsync() {
- // Create a port for waiting on the final result of this test.
- ReceivePort done = new ReceivePort.singleShot();
- done.receive((message, replyTo) {});
-
- // Test using the asynchronous way of opening an input stream.
- String fileName = getFilename("tests/standalone/src/readuntil_test.dat");
- File file = new File(fileName);
- file.exists();
- file.existsHandler = (exists) {
- if (exists) {
- file.openInputStream();
- } else {
- Expect.fail("Test file not found");
- }
- };
- file.inputStreamHandler = (InputStream stream) {
- done.toSendPort().send("Got an InputStream");
- };
- file.errorHandler = (String error) {
- Expect.fail("Error $error");
- };
-}
-
-
main() {
testStringInputStreamSync();
testInputStreamAsync();
@@ -126,5 +101,4 @@ main() {
testStringInputStreamAsync("readline_test1.dat", 111);
testStringInputStreamAsync("readline_test2.dat", 114);
testChunkedInputStream();
- testOpenInputStreamAsync();
}
« no previous file with comments | « samples/actors/samples/sssp/sssp-util.dart ('k') | tests/standalone/src/FileOutputStreamTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698