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

Side by Side Diff: tests/standalone/src/StreamPipeTest.dart

Issue 9494003: Wait for output file to close before deleting the file in pipe test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #library("StreamPipeTest"); 10 #library("StreamPipeTest");
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 tempDir.createTempSync(); 90 tempDir.createTempSync();
91 var dstFileName = tempDir.path + "/readline_test1.dat"; 91 var dstFileName = tempDir.path + "/readline_test1.dat";
92 var dstFile = new File(dstFileName); 92 var dstFile = new File(dstFileName);
93 dstFile.createSync(); 93 dstFile.createSync();
94 var fileOutput = dstFile.openOutputStreamSync(); 94 var fileOutput = dstFile.openOutputStreamSync();
95 95
96 socketInput.closeHandler = () { 96 socketInput.closeHandler = () {
97 // Check that the resulting file is equal to the initial 97 // Check that the resulting file is equal to the initial
98 // file. 98 // file.
99 bool result = compareFileContent(srcFileName, dstFileName); 99 bool result = compareFileContent(srcFileName, dstFileName);
100 new File(dstFileName).deleteSync(); 100 fileOutput.closeHandler = () {
101 tempDir.deleteSync(); 101 new File(dstFileName).deleteSync();
102 Expect.isTrue(result); 102 tempDir.deleteSync();
103 Expect.isTrue(result);
103 104
104 _socket.close(); 105 _socket.close();
105 106
106 // Run this twice. 107 // Run this twice.
107 if (count++ < 2) { 108 if (count++ < 2) {
108 runTest(); 109 runTest();
109 } else { 110 } else {
110 shutdown(); 111 shutdown();
111 } 112 }
113 };
112 }; 114 };
113 115
114 socketInput.pipe(fileOutput); 116 socketInput.pipe(fileOutput);
115 }; 117 };
116 118
117 fileInput.pipe(socketOutput); 119 fileInput.pipe(socketOutput);
118 } 120 }
119 121
120 // Connect to the server. 122 // Connect to the server.
121 _socket = new Socket(TestingServer.HOST, _port); 123 _socket = new Socket(TestingServer.HOST, _port);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 srcStream.pipe(dstStream, close: false); 286 srcStream.pipe(dstStream, close: false);
285 } 287 }
286 288
287 289
288 main() { 290 main() {
289 testFileToFilePipe1(); 291 testFileToFilePipe1();
290 testFileToFilePipe2(); 292 testFileToFilePipe2();
291 testFileToFilePipe3(); 293 testFileToFilePipe3();
292 PipeServerGame echoServerGame = new PipeServerGame.start(); 294 PipeServerGame echoServerGame = new PipeServerGame.start();
293 } 295 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698