OLD | NEW |
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 21 matching lines...) Expand all Loading... |
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>(count); |
39 var data2 = new List<int>(count); | 39 var data2 = new List<int>(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.readIntoSync(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.readIntoSync(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(); |
50 return false; | 50 return false; |
51 } | 51 } |
52 } | 52 } |
53 file1.closeSync(); | 53 file1.closeSync(); |
54 file2.closeSync(); | 54 file2.closeSync(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 var src = srcFile.openSync(); | 107 var src = srcFile.openSync(); |
108 var dst = dstFile.openSync(); | 108 var dst = dstFile.openSync(); |
109 var srcLength = src.lengthSync(); | 109 var srcLength = src.lengthSync(); |
110 var dstLength = dst.lengthSync(); | 110 var dstLength = dst.lengthSync(); |
111 Expect.equals(srcLength + 1, dstLength); | 111 Expect.equals(srcLength + 1, dstLength); |
112 Expect.isTrue(compareFileContent(srcFileName, | 112 Expect.isTrue(compareFileContent(srcFileName, |
113 dstFileName, | 113 dstFileName, |
114 count: srcLength)); | 114 count: srcLength)); |
115 dst.setPositionSync(srcLength); | 115 dst.setPositionSync(srcLength); |
116 var data = new List<int>(1); | 116 var data = new List<int>(1); |
117 var read2 = dst.readListSync(data, 0, 1); | 117 var read2 = dst.readIntoSync(data, 0, 1); |
118 Expect.equals(32, data[0]); | 118 Expect.equals(32, data[0]); |
119 src.closeSync(); | 119 src.closeSync(); |
120 dst.closeSync(); | 120 dst.closeSync(); |
121 dstFile.deleteSync(); | 121 dstFile.deleteSync(); |
122 tempDir.deleteSync(); | 122 tempDir.deleteSync(); |
123 donePort.toSendPort().send(null); | 123 donePort.toSendPort().send(null); |
124 }); | 124 }); |
125 }); | 125 }); |
126 } | 126 } |
127 | 127 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 }); | 169 }); |
170 }); | 170 }); |
171 } | 171 } |
172 | 172 |
173 | 173 |
174 main() { | 174 main() { |
175 testFileToFilePipe1(); | 175 testFileToFilePipe1(); |
176 testFileToFilePipe2(); | 176 testFileToFilePipe2(); |
177 testFileToFilePipe3(); | 177 testFileToFilePipe3(); |
178 } | 178 } |
OLD | NEW |