| OLD | NEW |
| 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 // 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 17 matching lines...) Expand all Loading... |
| 28 var length1 = file1.lengthSync(); | 28 var length1 = file1.lengthSync(); |
| 29 var length2 = file2.lengthSync(); | 29 var length2 = file2.lengthSync(); |
| 30 if (file1Offset == 0 && file2Offset == 0 && count == null) { | 30 if (file1Offset == 0 && file2Offset == 0 && count == null) { |
| 31 if (length1 != length2) { | 31 if (length1 != length2) { |
| 32 file1.closeSync(); | 32 file1.closeSync(); |
| 33 file2.closeSync(); | 33 file2.closeSync(); |
| 34 return false; | 34 return false; |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 if (count == null) count = length1; | 37 if (count == null) count = length1; |
| 38 var data1 = new List<int>(count); | 38 var data1 = new List<int>.fixedLength(count); |
| 39 var data2 = new List<int>(count); | 39 var data2 = new List<int>.fixedLength(count); |
| 40 if (file1Offset != 0) file1.setPositionSync(file1Offset); | 40 if (file1Offset != 0) file1.setPositionSync(file1Offset); |
| 41 if (file2Offset != 0) file2.setPositionSync(file2Offset); | 41 if (file2Offset != 0) file2.setPositionSync(file2Offset); |
| 42 var read1 = file1.readListSync(data1, 0, count); | 42 var read1 = file1.readListSync(data1, 0, count); |
| 43 Expect.equals(count, read1); | 43 Expect.equals(count, read1); |
| 44 var read2 = file2.readListSync(data2, 0, count); | 44 var read2 = file2.readListSync(data2, 0, count); |
| 45 Expect.equals(count, read2); | 45 Expect.equals(count, read2); |
| 46 for (var i = 0; i < count; i++) { | 46 for (var i = 0; i < count; i++) { |
| 47 if (data1[i] != data2[i]) { | 47 if (data1[i] != data2[i]) { |
| 48 file1.closeSync(); | 48 file1.closeSync(); |
| 49 file2.closeSync(); | 49 file2.closeSync(); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 dstStream.onClosed = () { | 216 dstStream.onClosed = () { |
| 217 var src = srcFile.openSync(); | 217 var src = srcFile.openSync(); |
| 218 var dst = dstFile.openSync(); | 218 var dst = dstFile.openSync(); |
| 219 var srcLength = src.lengthSync(); | 219 var srcLength = src.lengthSync(); |
| 220 var dstLength = dst.lengthSync(); | 220 var dstLength = dst.lengthSync(); |
| 221 Expect.equals(srcLength + 1, dstLength); | 221 Expect.equals(srcLength + 1, dstLength); |
| 222 Expect.isTrue(compareFileContent(srcFileName, | 222 Expect.isTrue(compareFileContent(srcFileName, |
| 223 dstFileName, | 223 dstFileName, |
| 224 count: srcLength)); | 224 count: srcLength)); |
| 225 dst.setPositionSync(srcLength); | 225 dst.setPositionSync(srcLength); |
| 226 var data = new List<int>(1); | 226 var data = new List<int>.fixedLength(1); |
| 227 var read2 = dst.readListSync(data, 0, 1); | 227 var read2 = dst.readListSync(data, 0, 1); |
| 228 Expect.equals(32, data[0]); | 228 Expect.equals(32, data[0]); |
| 229 src.closeSync(); | 229 src.closeSync(); |
| 230 dst.closeSync(); | 230 dst.closeSync(); |
| 231 dstFile.deleteSync(); | 231 dstFile.deleteSync(); |
| 232 tempDir.deleteSync(); | 232 tempDir.deleteSync(); |
| 233 donePort.toSendPort().send(null); | 233 donePort.toSendPort().send(null); |
| 234 }; | 234 }; |
| 235 }; | 235 }; |
| 236 | 236 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 srcStream.pipe(dstStream, close: false); | 286 srcStream.pipe(dstStream, close: false); |
| 287 } | 287 } |
| 288 | 288 |
| 289 | 289 |
| 290 main() { | 290 main() { |
| 291 testFileToFilePipe1(); | 291 testFileToFilePipe1(); |
| 292 testFileToFilePipe2(); | 292 testFileToFilePipe2(); |
| 293 testFileToFilePipe3(); | 293 testFileToFilePipe3(); |
| 294 PipeServerGame echoServerGame = new PipeServerGame.start(); | 294 PipeServerGame echoServerGame = new PipeServerGame.start(); |
| 295 } | 295 } |
| OLD | NEW |