| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import "package:async_helper/async_helper.dart"; | 8 import "package:async_helper/async_helper.dart"; |
| 9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
| 10 import "package:path/path.dart"; | 10 import "package:path/path.dart"; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 print(" stderr:"); | 29 print(" stderr:"); |
| 30 print(result.stderr); | 30 print(result.stderr); |
| 31 print(" arguments:"); | 31 print(" arguments:"); |
| 32 print(arguments); | 32 print(arguments); |
| 33 Expect.fail('Client subprocess exit code: ${result.exitCode}'); | 33 Expect.fail('Client subprocess exit code: ${result.exitCode}'); |
| 34 } | 34 } |
| 35 }); | 35 }); |
| 36 } | 36 } |
| 37 | 37 |
| 38 checkLocked(String path, | 38 checkLocked(String path, |
| 39 [int start, int end, FileLock mode = FileLock.EXCLUSIVE]) => | 39 [int start = 0, int end = -1, FileLock mode = FileLock.EXCLUSIVE]) => |
| 40 check(path, start, end, mode, locked: true); | 40 check(path, start, end, mode, locked: true); |
| 41 | 41 |
| 42 checkNotLocked(String path, | 42 checkNotLocked(String path, |
| 43 [int start, int end, FileLock mode = FileLock.EXCLUSIVE]) => | 43 [int start = 0, int end = -1, FileLock mode = FileLock.EXCLUSIVE]) => |
| 44 check(path, start, end, mode, locked: false); | 44 check(path, start, end, mode, locked: false); |
| 45 | 45 |
| 46 void testLockWholeFile() { | 46 void testLockWholeFile() { |
| 47 Directory directory = Directory.systemTemp.createTempSync('dart_file_lock'); | 47 Directory directory = Directory.systemTemp.createTempSync('dart_file_lock'); |
| 48 File file = new File(join(directory.path, "file")); | 48 File file = new File(join(directory.path, "file")); |
| 49 file.writeAsBytesSync(new List.filled(10, 0)); | 49 file.writeAsBytesSync(new List.filled(10, 0)); |
| 50 var raf = file.openSync(mode: WRITE); | 50 var raf = file.openSync(mode: WRITE); |
| 51 raf.lockSync(); | 51 raf.lockSync(); |
| 52 asyncStart(); | 52 asyncStart(); |
| 53 checkLocked(file.path).then((_) { | 53 checkLocked(file.path).then((_) { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 testLockWholeFileAsync(); | 316 testLockWholeFileAsync(); |
| 317 testLockRange(); | 317 testLockRange(); |
| 318 testLockRangeAsync(); | 318 testLockRangeAsync(); |
| 319 testLockEnd(); | 319 testLockEnd(); |
| 320 testLockEndAsync(); | 320 testLockEndAsync(); |
| 321 testLockShared(); | 321 testLockShared(); |
| 322 testLockSharedAsync(); | 322 testLockSharedAsync(); |
| 323 testLockAfterLength(); | 323 testLockAfterLength(); |
| 324 testLockAfterLengthAsync(); | 324 testLockAfterLengthAsync(); |
| 325 } | 325 } |
| OLD | NEW |