| 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 // Directory listing test. | 5 // Directory listing test. |
| 6 | 6 |
| 7 #import("dart:io"); | 7 #import("dart:io"); |
| 8 #import("dart:isolate"); | 8 #import("dart:isolate"); |
| 9 | 9 |
| 10 class DirectoryTest { | 10 class DirectoryTest { |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 Expect.throws(new Directory(location).createTempSync, | 441 Expect.throws(new Directory(location).createTempSync, |
| 442 (e) => e is DirectoryException); | 442 (e) => e is DirectoryException); |
| 443 } | 443 } |
| 444 } | 444 } |
| 445 | 445 |
| 446 | 446 |
| 447 testCreateTempError() { | 447 testCreateTempError() { |
| 448 var location = illegalTempDirectoryLocation(); | 448 var location = illegalTempDirectoryLocation(); |
| 449 if (location == null) return; | 449 if (location == null) return; |
| 450 | 450 |
| 451 var resultPort = new ReceivePort.singleShot(); | 451 var resultPort = new ReceivePort(); |
| 452 resultPort.receive((String message, ignored) { | 452 resultPort.receive((String message, ignored) { |
| 453 resultPort.close(); |
| 453 Expect.equals("error", message); | 454 Expect.equals("error", message); |
| 454 }); | 455 }); |
| 455 | 456 |
| 456 Directory dir = new Directory(location); | 457 Directory dir = new Directory(location); |
| 457 dir.onError = (error) { resultPort.toSendPort().send("error"); }; | 458 dir.onError = (error) { resultPort.toSendPort().send("error"); }; |
| 458 dir.createTemp(() => resultPort.toSendPort().send("success")); | 459 dir.createTemp(() => resultPort.toSendPort().send("success")); |
| 459 } | 460 } |
| 460 | 461 |
| 461 | 462 |
| 462 main() { | 463 main() { |
| 463 DirectoryTest.testMain(); | 464 DirectoryTest.testMain(); |
| 464 NestedTempDirectoryTest.testMain(); | 465 NestedTempDirectoryTest.testMain(); |
| 465 testCreateTempErrorSync(); | 466 testCreateTempErrorSync(); |
| 466 testCreateTempError(); | 467 testCreateTempError(); |
| 467 } | 468 } |
| OLD | NEW |