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

Side by Side Diff: tests/standalone/io/directory_create_race_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 // Test for a race condition that can occur when recursively creating 5 // Test for a race condition that can occur when recursively creating
6 // a directory multiple times simultaneously. This consistently reproduces 6 // a directory multiple times simultaneously. This consistently reproduces
7 // issue https://code.google.com/p/dart/issues/detail?id=7679 in revisions 7 // issue https://code.google.com/p/dart/issues/detail?id=7679 in revisions
8 // without the fix for this issue. 8 // without the fix for this issue.
9 9
10 import "dart:async"; 10 import "dart:async";
11 import "dart:io"; 11 import "dart:io";
12 12
13 import "package:async_helper/async_helper.dart"; 13 import "package:async_helper/async_helper.dart";
14 import "package:expect/expect.dart"; 14 import "package:expect/expect.dart";
15 15
16 void testCreateRecursiveRace() { 16 void testCreateRecursiveRace() {
17 asyncStart(); 17 asyncStart();
18 var temp = new Directory('').createTempSync(); 18 var temp = Directory.systemTemp.createTempSync('dart_directory_create_race');
19 var d = new Directory('${temp.path}/a/b/c/d/e'); 19 var d = new Directory('${temp.path}/a/b/c/d/e');
20 Future.wait([ 20 Future.wait([
21 d.create(recursive: true), 21 d.create(recursive: true),
22 d.create(recursive: true), 22 d.create(recursive: true),
23 d.create(recursive: true), 23 d.create(recursive: true),
24 d.create(recursive: true), 24 d.create(recursive: true),
25 d.create(recursive: true), 25 d.create(recursive: true),
26 d.create(recursive: true), 26 d.create(recursive: true),
27 d.create(recursive: true), 27 d.create(recursive: true),
28 d.create(recursive: true), 28 d.create(recursive: true),
29 d.create(recursive: true), 29 d.create(recursive: true),
30 d.create(recursive: true)]).then((_) { 30 d.create(recursive: true)]).then((_) {
31 Expect.isTrue(new Directory('${temp.path}/a').existsSync()); 31 Expect.isTrue(new Directory('${temp.path}/a').existsSync());
32 Expect.isTrue(new Directory('${temp.path}/a/b').existsSync()); 32 Expect.isTrue(new Directory('${temp.path}/a/b').existsSync());
33 Expect.isTrue(new Directory('${temp.path}/a/b/c').existsSync()); 33 Expect.isTrue(new Directory('${temp.path}/a/b/c').existsSync());
34 Expect.isTrue(new Directory('${temp.path}/a/b/c/d').existsSync()); 34 Expect.isTrue(new Directory('${temp.path}/a/b/c/d').existsSync());
35 Expect.isTrue(new Directory('${temp.path}/a/b/c/d/e').existsSync()); 35 Expect.isTrue(new Directory('${temp.path}/a/b/c/d/e').existsSync());
36 temp.delete(recursive: true).then((_) { 36 temp.delete(recursive: true).then((_) {
37 asyncEnd(); 37 asyncEnd();
38 }); 38 });
39 }); 39 });
40 } 40 }
41 41
42 void main() { 42 void main() {
43 testCreateRecursiveRace(); 43 testCreateRecursiveRace();
44 testCreateRecursiveRace(); 44 testCreateRecursiveRace();
45 } 45 }
OLDNEW
« no previous file with comments | « tests/standalone/io/directory_chdir_test.dart ('k') | tests/standalone/io/directory_error_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698