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/stream_pipe_test.dart

Issue 12441003: Rename String.concat to operator+. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 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
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 // 4 //
5 // VMOptions= 5 // VMOptions=
6 // VMOptions=--short_socket_read 6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write 7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write 8 // VMOptions=--short_socket_read --short_socket_write
9 library ServerTest; 9 library ServerTest;
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // Force test to timeout if one of the handlers is 61 // Force test to timeout if one of the handlers is
62 // not called. 62 // not called.
63 ReceivePort donePort = new ReceivePort(); 63 ReceivePort donePort = new ReceivePort();
64 donePort.receive((message, ignore) { donePort.close(); }); 64 donePort.receive((message, ignore) { donePort.close(); });
65 65
66 String srcFileName = 66 String srcFileName =
67 getDataFilename("tests/standalone/io/readline_test1.dat"); 67 getDataFilename("tests/standalone/io/readline_test1.dat");
68 var srcStream = new File(srcFileName).openRead(); 68 var srcStream = new File(srcFileName).openRead();
69 69
70 var tempDir = new Directory('').createTempSync(); 70 var tempDir = new Directory('').createTempSync();
71 String dstFileName = tempDir.path.concat("/readline_test1.dat"); 71 String dstFileName = tempDir.path + "/readline_test1.dat";
72 new File(dstFileName).createSync(); 72 new File(dstFileName).createSync();
73 var output = new File(dstFileName).openWrite(); 73 var output = new File(dstFileName).openWrite();
74 srcStream.pipe(output).then((_) { 74 srcStream.pipe(output).then((_) {
75 bool result = compareFileContent(srcFileName, dstFileName); 75 bool result = compareFileContent(srcFileName, dstFileName);
76 new File(dstFileName).deleteSync(); 76 new File(dstFileName).deleteSync();
77 tempDir.deleteSync(); 77 tempDir.deleteSync();
78 Expect.isTrue(result); 78 Expect.isTrue(result);
79 donePort.toSendPort().send(null); 79 donePort.toSendPort().send(null);
80 }); 80 });
81 } 81 }
82 82
83 83
84 // Test piping from one file to another and write additional data to 84 // Test piping from one file to another and write additional data to
85 // the output stream after piping finished. 85 // the output stream after piping finished.
86 testFileToFilePipe2() { 86 testFileToFilePipe2() {
87 // Force test to timeout if one of the handlers is 87 // Force test to timeout if one of the handlers is
88 // not called. 88 // not called.
89 ReceivePort donePort = new ReceivePort(); 89 ReceivePort donePort = new ReceivePort();
90 donePort.receive((message, ignore) { donePort.close(); }); 90 donePort.receive((message, ignore) { donePort.close(); });
91 91
92 String srcFileName = 92 String srcFileName =
93 getDataFilename("tests/standalone/io/readline_test1.dat"); 93 getDataFilename("tests/standalone/io/readline_test1.dat");
94 var srcFile = new File(srcFileName); 94 var srcFile = new File(srcFileName);
95 var srcStream = srcFile.openRead(); 95 var srcStream = srcFile.openRead();
96 96
97 var tempDir = new Directory('').createTempSync(); 97 var tempDir = new Directory('').createTempSync();
98 var dstFileName = tempDir.path.concat("/readline_test1.dat"); 98 var dstFileName = tempDir.path + "/readline_test1.dat";
99 var dstFile = new File(dstFileName); 99 var dstFile = new File(dstFileName);
100 dstFile.createSync(); 100 dstFile.createSync();
101 var output = dstFile.openWrite(); 101 var output = dstFile.openWrite();
102 output.writeStream(srcStream).then((_) { 102 output.writeStream(srcStream).then((_) {
103 output.writeBytes([32]); 103 output.writeBytes([32]);
104 output.close(); 104 output.close();
105 output.done.then((_) { 105 output.done.then((_) {
106 var src = srcFile.openSync(); 106 var src = srcFile.openSync();
107 var dst = dstFile.openSync(); 107 var dst = dstFile.openSync();
108 var srcLength = src.lengthSync(); 108 var srcLength = src.lengthSync();
(...skipping 22 matching lines...) Expand all
131 // not called. 131 // not called.
132 ReceivePort donePort = new ReceivePort(); 132 ReceivePort donePort = new ReceivePort();
133 donePort.receive((message, ignore) { donePort.close(); }); 133 donePort.receive((message, ignore) { donePort.close(); });
134 134
135 String srcFileName = 135 String srcFileName =
136 getDataFilename("tests/standalone/io/readline_test1.dat"); 136 getDataFilename("tests/standalone/io/readline_test1.dat");
137 var srcFile = new File(srcFileName); 137 var srcFile = new File(srcFileName);
138 var srcStream = srcFile.openRead(); 138 var srcStream = srcFile.openRead();
139 139
140 var tempDir = new Directory('').createTempSync(); 140 var tempDir = new Directory('').createTempSync();
141 var dstFileName = tempDir.path.concat("/readline_test1.dat"); 141 var dstFileName = tempDir.path + "/readline_test1.dat";
142 var dstFile = new File(dstFileName); 142 var dstFile = new File(dstFileName);
143 dstFile.createSync(); 143 dstFile.createSync();
144 var output = dstFile.openWrite(); 144 var output = dstFile.openWrite();
145 output.writeStream(srcStream).then((_) { 145 output.writeStream(srcStream).then((_) {
146 var srcStream2 = srcFile.openRead(); 146 var srcStream2 = srcFile.openRead();
147 output.writeStream(srcStream2).then((_) { 147 output.writeStream(srcStream2).then((_) {
148 output.close(); 148 output.close();
149 output.done.then((_) { 149 output.done.then((_) {
150 var src = srcFile.openSync(); 150 var src = srcFile.openSync();
151 var dst = dstFile.openSync(); 151 var dst = dstFile.openSync();
(...skipping 16 matching lines...) Expand all
168 }); 168 });
169 }); 169 });
170 } 170 }
171 171
172 172
173 main() { 173 main() {
174 testFileToFilePipe1(); 174 testFileToFilePipe1();
175 testFileToFilePipe2(); 175 testFileToFilePipe2();
176 testFileToFilePipe3(); 176 testFileToFilePipe3();
177 } 177 }
OLDNEW
« no previous file with comments | « tests/standalone/io/process_working_directory_test.dart ('k') | tests/standalone/package/packages/lib1.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698