Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 "use strict";
3 Components.utils.import("resource://gre/modules/osfile.jsm");
4 Components.utils.import("resource://gre/modules/Task.jsm");
6 function run_test() {
7 do_test_pending();
8 run_next_test();
9 }
11 /**
12 * Test to ensure that |File.prototype.flush| is available in the async API.
13 */
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 });
30 add_task(do_test_finished);