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

Side by Side Diff: tests/standalone/io/stream_pipe_test.dart

Issue 25471003: Modify tests to use Directory.systemTemp (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 7 years, 2 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 9
10 import "dart:io"; 10 import "dart:io";
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // after wards. 60 // after wards.
61 testFileToFilePipe1() { 61 testFileToFilePipe1() {
62 // Force test to timeout if one of the handlers is 62 // Force test to timeout if one of the handlers is
63 // not called. 63 // not called.
64 asyncStart(); 64 asyncStart();
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 = Directory.systemTemp.createTempSync('dart_stream_pipe');
71 String dstFileName = tempDir.path + "/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 asyncEnd(); 79 asyncEnd();
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 asyncStart(); 89 asyncStart();
90 90
91 String srcFileName = 91 String srcFileName =
92 getDataFilename("tests/standalone/io/readline_test1.dat"); 92 getDataFilename("tests/standalone/io/readline_test1.dat");
93 var srcFile = new File(srcFileName); 93 var srcFile = new File(srcFileName);
94 var srcStream = srcFile.openRead(); 94 var srcStream = srcFile.openRead();
95 95
96 var tempDir = new Directory('').createTempSync(); 96 var tempDir = Directory.systemTemp.createTempSync('dart_stream_pipe');
97 var dstFileName = tempDir.path + "/readline_test1.dat"; 97 var dstFileName = tempDir.path + "/readline_test1.dat";
98 var dstFile = new File(dstFileName); 98 var dstFile = new File(dstFileName);
99 dstFile.createSync(); 99 dstFile.createSync();
100 var output = dstFile.openWrite(); 100 var output = dstFile.openWrite();
101 output.addStream(srcStream).then((_) { 101 output.addStream(srcStream).then((_) {
102 output.add([32]); 102 output.add([32]);
103 output.close(); 103 output.close();
104 output.done.then((_) { 104 output.done.then((_) {
105 var src = srcFile.openSync(); 105 var src = srcFile.openSync();
106 var dst = dstFile.openSync(); 106 var dst = dstFile.openSync();
(...skipping 21 matching lines...) Expand all
128 testFileToFilePipe3() { 128 testFileToFilePipe3() {
129 // Force test to timeout if one of the handlers is 129 // Force test to timeout if one of the handlers is
130 // not called. 130 // not called.
131 asyncStart(); 131 asyncStart();
132 132
133 String srcFileName = 133 String srcFileName =
134 getDataFilename("tests/standalone/io/readline_test1.dat"); 134 getDataFilename("tests/standalone/io/readline_test1.dat");
135 var srcFile = new File(srcFileName); 135 var srcFile = new File(srcFileName);
136 var srcStream = srcFile.openRead(); 136 var srcStream = srcFile.openRead();
137 137
138 var tempDir = new Directory('').createTempSync(); 138 var tempDir = Directory.systemTemp.createTempSync('dart_stream_pipe');
139 var dstFileName = tempDir.path + "/readline_test1.dat"; 139 var dstFileName = tempDir.path + "/readline_test1.dat";
140 var dstFile = new File(dstFileName); 140 var dstFile = new File(dstFileName);
141 dstFile.createSync(); 141 dstFile.createSync();
142 var output = dstFile.openWrite(); 142 var output = dstFile.openWrite();
143 output.addStream(srcStream).then((_) { 143 output.addStream(srcStream).then((_) {
144 var srcStream2 = srcFile.openRead(); 144 var srcStream2 = srcFile.openRead();
145 output.addStream(srcStream2).then((_) { 145 output.addStream(srcStream2).then((_) {
146 output.close(); 146 output.close();
147 output.done.then((_) { 147 output.done.then((_) {
148 var src = srcFile.openSync(); 148 var src = srcFile.openSync();
(...skipping 17 matching lines...) Expand all
166 }); 166 });
167 }); 167 });
168 } 168 }
169 169
170 170
171 main() { 171 main() {
172 testFileToFilePipe1(); 172 testFileToFilePipe1();
173 testFileToFilePipe2(); 173 testFileToFilePipe2();
174 testFileToFilePipe3(); 174 testFileToFilePipe3();
175 } 175 }
OLDNEW
« no previous file with comments | « tests/standalone/io/stdout_close_test.dart ('k') | tests/standalone/io/test_extension_fail_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698