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

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

Issue 23886004: Update dart:io tests to use asyncStart/asyncEnd (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 3 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) 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 // Dart test program for testing error handling in directory I/O. 5 // Dart test program for testing error handling in directory I/O.
6 6
7 import "package:expect/expect.dart";
8 import "dart:async"; 7 import "dart:async";
9 import "dart:io"; 8 import "dart:io";
10 import "dart:isolate"; 9
10 import "package:async_helper/async_helper.dart";
11 import "package:expect/expect.dart";
11 12
12 Directory tempDir() { 13 Directory tempDir() {
13 return new Directory('').createTempSync(); 14 return new Directory('').createTempSync();
14 } 15 }
15 16
16 17
17 bool checkCreateInNonExistentFileException(e) { 18 bool checkCreateInNonExistentFileException(e) {
18 Expect.isTrue(e is DirectoryException); 19 Expect.isTrue(e is DirectoryException);
19 Expect.isTrue(e.osError != null); 20 Expect.isTrue(e.osError != null);
20 Expect.isTrue(e.toString().indexOf("Creation failed") != -1); 21 Expect.isTrue(e.toString().indexOf("Creation failed") != -1);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 done(); 193 done();
193 }); 194 });
194 } 195 }
195 196
196 197
197 void runTest(Function test) { 198 void runTest(Function test) {
198 // Create a temporary directory for the test. 199 // Create a temporary directory for the test.
199 var temp = new Directory('').createTempSync(); 200 var temp = new Directory('').createTempSync();
200 201
201 // Wait for the test to finish and delete the temporary directory. 202 // Wait for the test to finish and delete the temporary directory.
202 ReceivePort p = new ReceivePort(); 203 asyncStart();
203 p.receive((x,y) {
204 p.close();
205 temp.deleteSync(recursive: true);
206 });
207 204
208 // Run the test. 205 // Run the test.
209 test(temp, () => p.toSendPort().send(null)); 206 test(temp, () {
207 temp.deleteSync(recursive: true);
208 asyncEnd();
209 });
210 } 210 }
211 211
212 212
213 main() { 213 main() {
214 runTest(testCreateInNonExistent); 214 runTest(testCreateInNonExistent);
215 runTest(testCreateTempInNonExistent); 215 runTest(testCreateTempInNonExistent);
216 runTest(testDeleteNonExistent); 216 runTest(testDeleteNonExistent);
217 runTest(testDeleteRecursivelyNonExistent); 217 runTest(testDeleteRecursivelyNonExistent);
218 runTest(testListNonExistent); 218 runTest(testListNonExistent);
219 runTest(testRenameNonExistent); 219 runTest(testRenameNonExistent);
220 runTest(testRenameFileAsDirectory); 220 runTest(testRenameFileAsDirectory);
221 runTest(testRenameOverwriteFile); 221 runTest(testRenameOverwriteFile);
222 } 222 }
OLDNEW
« no previous file with comments | « tests/standalone/io/directory_create_race_test.dart ('k') | tests/standalone/io/directory_fuzz_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698