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 | 9 |
10 #import("dart:io"); | 10 #import("dart:io"); |
11 #import("dart:isolate"); | 11 #import("dart:isolate"); |
12 #source("testing_server.dart"); | 12 #source("testing_server.dart"); |
13 | 13 |
14 // Helper method to be able to run the test from the runtime | 14 // Helper method to be able to run the test from the runtime |
15 // directory, or the top directory. | 15 // directory, or the top directory. |
16 String getDataFilename(String path) => | 16 String getDataFilename(String path) => |
17 new File(path).existsSync() ? path : '../$path'; | 17 new File(path).existsSync() ? path : '../$path'; |
18 | 18 |
19 | 19 |
20 bool compareFileContent(String fileName1, | 20 bool compareFileContent(String fileName1, |
21 String fileName2, | 21 String fileName2, |
22 [int file1Offset = 0, | 22 {int file1Offset: 0, |
23 int file2Offset = 0, | 23 int file2Offset: 0, |
24 int count]) { | 24 int count}) { |
25 var file1 = new File(fileName1).openSync(); | 25 var file1 = new File(fileName1).openSync(); |
26 var file2 = new File(fileName2).openSync(); | 26 var file2 = new File(fileName2).openSync(); |
27 var length1 = file1.lengthSync(); | 27 var length1 = file1.lengthSync(); |
28 var length2 = file2.lengthSync(); | 28 var length2 = file2.lengthSync(); |
29 if (file1Offset == 0 && file2Offset == 0 && count == null) { | 29 if (file1Offset == 0 && file2Offset == 0 && count == null) { |
30 if (length1 != length2) { | 30 if (length1 != length2) { |
31 file1.closeSync(); | 31 file1.closeSync(); |
32 file2.closeSync(); | 32 file2.closeSync(); |
33 return false; | 33 return false; |
34 } | 34 } |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 srcStream.pipe(dstStream, close: false); | 285 srcStream.pipe(dstStream, close: false); |
286 } | 286 } |
287 | 287 |
288 | 288 |
289 main() { | 289 main() { |
290 testFileToFilePipe1(); | 290 testFileToFilePipe1(); |
291 testFileToFilePipe2(); | 291 testFileToFilePipe2(); |
292 testFileToFilePipe3(); | 292 testFileToFilePipe3(); |
293 PipeServerGame echoServerGame = new PipeServerGame.start(); | 293 PipeServerGame echoServerGame = new PipeServerGame.start(); |
294 } | 294 } |
OLD | NEW |