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

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

Issue 1892623002: Fixes leak of native File objects. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 8 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
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698