|
1 "use strict"; |
|
2 |
|
3 Components.utils.import("resource://gre/modules/osfile.jsm"); |
|
4 Components.utils.import("resource://gre/modules/Task.jsm"); |
|
5 |
|
6 function run_test() { |
|
7 do_test_pending(); |
|
8 run_next_test(); |
|
9 } |
|
10 |
|
11 /** |
|
12 * Test to ensure that |File.prototype.flush| is available in the async API. |
|
13 */ |
|
14 |
|
15 add_task(function test_flush() { |
|
16 let path = OS.Path.join(OS.Constants.Path.tmpDir, |
|
17 "test_osfile_async_flush.tmp"); |
|
18 let file = yield OS.File.open(path, {trunc: true, write: true}); |
|
19 try { |
|
20 try { |
|
21 yield file.flush(); |
|
22 } finally { |
|
23 yield file.close(); |
|
24 } |
|
25 } finally { |
|
26 yield OS.File.remove(path); |
|
27 } |
|
28 }); |
|
29 |
|
30 add_task(do_test_finished); |